Part Number Hot Search : 
000950 SBL10 BT136 D5555C 74LVCH 3NB60 P6KE22AJ L120D
Product Description
Full Text Search
 

To Download TMP91FW60FG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  16 bit microcontroller tlcs-900/l1 series TMP91FW60FG tmp91fw60dfg revision 1.9 toshiba corporation
the information contained herein is subject to change without notice. toshiba is continually working to improve the qual ity and reliability of its products. nevertheless, semiconductor devices in general can malfunction or fa il due to their inherent electrical sensitivity and vulnerability to physical stress. it is the responsibility of the buyer, when utilizi ng toshiba products, to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, please ensure that to shiba products are used w ithin specified operating ranges as set forth in the most recent toshiba products specifications. also, please keep in mind the precauti ons and conditions set forth in the ? handling guide for semiconductor devices, ? or ? toshiba semiconductor reliability handbook ? etc. the toshiba products listed in this document are in tended for usage in general electronics applications (computer, personal equipment, office equipment, m easuring equipment, indust rial robotics, domestic appliances, etc.). these toshiba products are neither intended nor wa rranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury ( ? unintended usage ? ). unintended usage include atomic energy control instruments, airplane or spaceship instruments, transportation instru ments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc. unintended usage of toshiba products listed in this document shall be made at the customer's own risk. the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any applicable laws and regulations. the information contained herein is presented only as a guide for the applications of our products. no responsibility is assumed by to shiba for any infringements of patents or other rights of the third parties which may result from its use. no license is granted by implication or otherwise under any patents or other rights of toshiba or the third parties. please contact your sales representative for product- by-product details in this document regarding rohs compatibility. please use these products in this docum ent in compliance with all applicable laws and regulations that regulate the inclusion or use of co ntrolled substances. toshib a assumes no liability for damage or losses occurring as a result of nonc ompliance with applicable laws and regulations. ? 2007 toshiba corporation all rights reserved
revision history date revision 2006/2/28 0.1 tentative 2006/3/06 0.2 flash section is corrected. 2006/3/13 0.3 correction of a clerical error. 2006/8/04 1.4 p99 figure 5-3 is corrected. p99 figure 5-4 is deleted. p272 the value is added to t.b.d of specification section. p126 figure 7-1 p132-133 tmrb mode register ta1out of tb3m od and tb4mod is corrected. ta1out -> ta3out, ta5out p226 table 14-6 is corrected p178 9.3.3.14 the description is corrected. 2006/10/31 1.5 scout: system clock output ffph -> fsys dc spec vih/vi l is corrected. table 2-8 sample warm-up times after clearance of stop mode is corrected. table 4-2 i/o port setting list is corrected. port 3, 4, 7 control register/fun ction register contrast table is corrected. 1.1 features interrupts is corrected 9.3.2 i2cbus mode control register note1:set the to ?000? before switching to a clocked- synchronous 8-bit sio mode is deleted. 9.3.4.1 device initialization sbi0cr1 is deleted. 9.3.4.2 start condition and slave address generation (1) master mode register settings is corrected. 6.4.1.2 generating a 50% duty radio square wave pulse register settings example is corrected. 6.4.3 8-bit ppg output mode. register settings is corrected. 6.4.4 8-bit pwm output mode register settings example is corrected. table 14-6 correspondence betw een operating frequency and baund rate in single boot mode is corrected. 15.2 dc electrical characteristics peak current for intermittent operation t.b.d -> 20ma
date revision 2007/2/16 1.6 1.1 features program patch logic 2.3.4 prescaler clock co ntroller is corrected. 16.table of sfr's 2.1 reset 10 system clocks 16us -> 1us 18. points to note and restriction 2007/4/16 1.7 15.2 dc electrical characteristics power down voltage min 4.5v -> 2.0v 14.6.10 addresses of program example are corrected 2007/8/27 1.8 dmar register (89h) is corrected by rwm prohibition. 18.2 points of note j. releasing the halt mode by requesting an interruption is deleted. 2.3.2 note3 is added 8.2.1 sio plescaler is correct ed, and table 8-2 is corrected 8.3 note2 and note3 are added 18.2 points of note j.clocks for serial channels (sio) is added 2007/10/15 1.9 7.3 sfr 16. table of sfr's tb0ffcr, tb1ffcr, tb2ffcr, tb3ffcr and tb4ffcr register is corrected.
page 1 2007-10-15 20070701-en ? the information contained herein is subject to change without notice. ? toshiba is continually working to improve the quality and reli ability of its products. neverthel ess, semiconductor devices in general can malfunction or fail due to their inherent el ectrical sensitivity and vul nerability to physical stre ss. it is the responsibility of the buyer, when utilizing toshiba products, to comply with the standards of sa fety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such toshiba products could cause loss of human life, bodily injury or damage to property. in developing your designs, pleas e ensure that toshiba products are used within specified operating ranges as set forth in the most recent toshiba products specifications. also, please keep in mind the precautions and conditions set forth in the ?handling gui de for semiconductor devices,? or ?toshiba semiconductor reliabi lity handbook? etc. ? the toshiba products listed in this document are intended for usage in general electronics applic ations (computer, personal eq uip- ment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). these toshiba products are neithe r intended nor warranted for usage in equipment that requires extr aordinarily high quality and/or re liability or a malfunctionor failure of which may cause loss of human life or bod ily injury (?unintended usage?). unintended us age include atomic energy control instru ments, airplane or spaceship instruments, transporta tion instruments, traffic signal instrume nts, combustion control instruments, medi cal instru- ments, all types of safety dev ices, etc. unintended usage of toshiba products li sted in this document shall be made at the cust omer's own risk. ? the products described in this document shall not be used or embedded to any downstream products of which manufacture, use and /or sale are prohibited under any appl icable laws and regulations. ? the information contained herein is present ed only as a guide for the applications of our products. no responsibility is assum ed by toshiba for any infringements of patents or other rights of the th ird parties which may result from its use. no license is gran ted by impli- cation or otherwise under any patents or other rights of toshiba or the third parties. ? please contact your sales representative for product-by-product details in this document regarding rohs compatibility. please use these products in this document in compliance wi th all applicable laws and regulations that regulate the inclusion or use of controll ed sub- stances. toshiba assumes no liabili ty for damage or losses occurring as a result of noncompliance with applicable laws and regu lations. this product uses the super flash ? technology under the licence of silicon storage technology, inc. super flash ? is registered trademark of silicon storage technology, inc. tmp91fw60 cmos 16 bit microcontroller TMP91FW60FG/dfg 1.1 features ? high-speed 16-bit cpu (900/l1 cpu) - instruction mnemonics are upward-compatible with tlcs-900,900/h,900/l - 16 mbytes of linear address space - general-purpose registers and register banks - 16-bit multiplication and division instructions; bit transfer and arithmetic instructions - micro dma: 4 channels (800ns/2 bytes at 20mhz) ? minimum instruction execution time:200ns (at 20mhz) ? built-in memory - rom:128k bytes (flash rom) - ram:8k bytes ? external memory expansion - expandable up to 16 mbytes (shared program/data area) - can simultaneously support 8/16-bit width external data bus dynamic data bus syzing ? 8-bit timers: 6 channels ? 16-bit timers: 5 channels ? general-purpose serial interface: 5 channels - uart/synchronous mode: 3 channels -i 2 c bus mode: 2 channels ? 10-bit ad converter (built-in sample hold circuit): 16 channels ? special timer for clock product no. rom (flash rom) ram package TMP91FW60FG 128k bytes 8k bytes lqfp100-p-1414-0.50f tmp91fw60dfg qfp100-p-1420-0.65a
page 2 2007-10-15 tmp91fw60 ? watchdog timer ? program patch logic: 6 banks ? chip select/wait controller: 4 channels ? interrupts: 57 interrupts - 9 cpu interrupts: software interrupt instruction and illegal instruction - 36 internal interrupts: 7 priority levels are selectable - 12 external interrupts: 7 priority levels are select able (among 1 interrupts are selectable edge mode) ? input/output ports: 83 pins ? standby function: three halt modes: idle2 (programmable), idle1 and stop ? clock controller - clock gear function: select a high-frequency clock fc/1 to fc/16 - oscillator for clock (fs = 32.768 khz) ? operating voltage flash read operation > vcc=4.5 v - 5.5 v (fc max = 20mhz) flash write/erase operation > vcc=4.75 v - 5.25 v (fc max = 20mhz) ? package - lqfp100-p-1414-0.50f (TMP91FW60FG) - qfp100-p-1420-0.65a (tmp91fw60dfg)
page 3 2007-10-15 tmp91fw60 1.2 pin assignment diagram figure 1-1 pin assignment(TMP91FW60FG) vrefh TMP91FW60FG lqfp100 topview 1 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 avss p70/ta0in p71/ta1out p72/ta3out p73/ta4in p74/ta5out p75/int0 p80/tb0in0/int5 p81/tb0in1/int6 avcc p82/tb0out0 p83/tb0out1 p84/tb1in0/int7 p85/tb1in1/int8 p86/tb1out0 p87/tb1out1 p90/txd0 p91/rxd0 p92/sclk0/cts0 p93/txd1 p95/sclk1/cts1 dvcc p30/tb3in0/int3/sda0 pz3/r/w pz2/hwr pz1/wr pz0/rd p27/a7/a23 p26/a6/a22 p25/a5/a21 p24/a4/a20 p23/a3/a19 p22/a2/a18 dvcc nmi dvss p21/a1/a17 p20/a0/a16 p17/ad15/a15 p16/ad14/a14 p15/ad13/a13 p14/ad12/a12 p13/ad11/a11 p12/ad10/a10 p11/ad9/a9 p10/ad8/a8 p07/ad7 p06/ad6 p05/ad5 p04/ad4 p03/ad3 p02/ad2 p01/ad1 p00/ad0 p44/ale p43/cs3/sclk2/cts2 p42/cs2/rxd2 p41/cs1/txd2 p40/cs0/scout pa3/tb2out1 pa2/tb2out0 pa1/tb2in1/int2 pa0/tb2in0/int1 emu1 boot/emu0 p97/xt2 p96/xt1 reset am1 x1 dvss x2 p60/an8 p65/an13 p57/an7 p61/an9 p62/an10 p63/an11 p64/an12 p55/an5 p66/an14 p67/an15 p53/an3 p52/an2 p51/an1 p50/an0 dvss dvcc pb3/tb4out1 pb2/tb4out0 pb1/tb4in1/int10/scl1 pb0/tb4in0/int9/sda1 p33/tb3out1 p32/wait/tb3out0 am0 p31/tb3in1/int4/scl0 p56/an6 p94/rxd1 p54/an4
page 4 2007-10-15 tmp91fw60 figure 1-2 pin a ssignment(tmp91fw60dfg) tmp91fw60dfg qfp100 topview 35 40 45 55 60 65 70 75 pb0/tb4in0/int9/sda1 p66/an14 p67/an15 vrefh avss avcc p70/ta0in p71/ta1out p72/ta3out p73/ta4in p74/ta5out p75/int0 p80/tb0in0/int5 p81/tb0in1/int6 p82/tb0out0 p83/tb0out1 p84/tb1in0/int7 p85/tb1in1/int8 p86/tb1out0 p87/tb1out1 p90/txd0 p91/rxd0 p92/sclk0/cts0 p93/txd1 p94/rxd1 p95/sclk1/cts1 am0 dvcc x2 dvss x1 am1 reset p96/xt1 p97/xt2 emu0/boot emu1 pa0/tb2in0/int1 pa1/tb2in1/int2 pa2/tb2out0 pa3/tb2out1 p40/cs0/scout p41/cs1/txd2 p42/cs2/rxd2 p43/cs3/sclk2/cts2 p44/ale p00/ad0 p01/ad1 p02/ad2 p03/ad3 p04/ad4 p05/ad5 p06/ad6 p07/ad7 p10/ad8/a8 p11/ad9/a9 p12/ad10/a10 p13/ad11/a11 p14/ad12/a12 p15/ad13/a13 p16/ad14/a14 p17/ad15/a15 p20/a0/a16 p21/a1/a17 dvss nmi dvcc p22/a2/a18 p23/a3/a19 p24/a4/a20 p25/a5/a21 p26/a6/a22 p27/a7/a23 pz0/rd pz1/wr pz2/hwr pz3/r/w p30/tb3in0/int3/sda0 p31/tb3in1/int4/scl0 p32/wait/tb3out0 p33/tb3out1 pb1/tb4in1/int10/scl1 pb2/tb4out0 pb3/tb4out1 dvcc dvss p50/an0 p51/an1 p52/an2 p53/an3 p54/an4 p55/an5 p56/an6 p57/an7 p60/an8 p61/an9 p62/an10 p63/an11 p64/an12 p65/an13 1 10 5 15 20 25 30 50 80 85 90 95 100
page 5 2007-10-15 tmp91fw60 1.3 block diagram figure 1-3 block diagram
page 6 2007-10-15 tmp91fw60 1.4 pin names and functions table 1-1 pin names and functions(1/3) pin name pin number input / output functions p00-p07 ad0-ad7 8 io io port 0: i/o port that allows i/o to be selected at the bit level address data (lower): 0 to 7 address/data bus p10-p17 ad8-ad15 a8-a15 8 io io o port1: i/o port that allows i/o to be selected at the bit level address data (upper): 8 to 15 of address/data bus address: 8 to 15 of address bus p20-p27 a0-a7 a16-a23 8 io o o port 2: i/o port that allows i/o to be selected at the bit level address: 0 to 7 of address bus address: 16 to 23 of address bus pz0 rd 1 o o port z0: output port read:strobe signal for reading external memory pz1 wr 1 o o port z1: output port write: strobe signal for writing data to pins ad0 to ad7 pz2 hwr 1 io o port z2: i/o port (with pull-up resistor) high write: strobe signal for writing data to pins ad8 to ad15 pz3 r/w 1 io o port z3: i/o port (with pull-up resistor) read/write: 1 represents read or dummy cycle; 0 represents write cycle. p30 tb3in0 int3 sda0 1 io i i io port 30: i/o port 16-bit timer 3 input 0:timer b3 count/capture trigger input 0 interrupt request pin 3: interrupt request pin with programmable rising edge / falling edge. serial bus interface data 0 in i2c bus mode. p31 tb3in1 int4 scl0 1 io i i io port 31: i/o port 16-bit timer 3 input 1:timer b3 count/capture trigger input 1 interrupt request pin 4: interrupt request on rising edge serial bus interface clock 0 in i2c bus mode. p32 wait tb3out0 1 io i o port 32: i/o port wait: pin used to request cpu bus wait ((1 n) wait mode) 16-bit timer 3 output 0: timer b3 output 0 p33 tb3out1 1 io o port 33: i/o port 16-bit timer 3 output 1: timer b3 output 1 p40 cs0 scout 1 io o o port 40: i/o port (with pull-up resistor) chip select 0: outputs 0 when address is within specified address area system clock output: outputs f sys or fs clock. p41 cs1 txd2 1 io o o port 41: i/o port (with pull-up resistor) chip select 1: outputs 0 when address is within specified address area serial send data 2 p42 cs2 rxd2 1 io o i port 42: i/o port (with pull-up resistor) chip select 2: outputs 0 when address is within specified address area serial receive data 2 p43 cs3 sclk2 cts2 1 io o io i port 43: i/o port (with pull-up resistor) chip select 3: outputs 0 when address is within specified address area serial clock i/o 2 serial data send enable 2 (clear to send) p44 ale 1 io o port 44: i/o port (with pull-up resistor) address latch enable p50-57 an0-an7 8 io i port 5: i/o port analog input: pin used to input to ad converter
page 7 2007-10-15 tmp91fw60 p60-67 an8-an15 8 io i port 6: i/o port analog input: pin used to input to ad converter p70 ta0in 1 io i port 70: i/o port 8-bit timer 0 input: timer a0 input p71 ta1out 1 io o port 71: i/o port 8-bit timer 1 output:timer a1 output p72 ta3out 1 io o port 72: i/o port 8-bit timer 3 output:timer a3 output p73 ta4in 1 io i port 73: i/o port 8-bit timer 4 input: timer a4 input p74 ta5out 1 io o port 74: i/o port 8-bit timer 5 output:timer a5 output p75 int0 1 io i port 75: i/o port interrupt request pin 0: interrupt request pin with programmable level / rising edge / falling edge. p80 tb0in0 int5 1 io i i port 80: i/o port 16-bit timer 0 input 0:timer b0 count/capture trigger input 0 interrupt request pin 5: interrupt request pin with programmable rising edge / falling edge. p81 tb0in1 int6 1 io i i port 81: i/o port 16-bit timer 0 input 1:timer b0 count/capture trigger input 1 interrupt request pin 6: interrupt request on rising edge p82 tb0out0 1 io o port 82: i/o port 16-bit timer 0 output 0: timer b0 output 0 p83 tb0out1 1 io o port 83: i/o port 16-bit timer 0 output 1: timer b0 output 1 p84 tb1in0 int7 1 io i i port 84: i/o port 16-bit timer 1 input 0:timer b1 count/capture trigger input 0 interrupt request pin 7: interrupt request pin with programmable rising edge / falling edge. p85 tb1in1 int8 1 io i i port 85: i/o port 16-bit timer 1 input 1:timer b1 count/capture trigger input 1 interrupt request pin 8: interrupt request on rising edge p86 tb1out0 1 io o port 86: i/o port 16-bit timer 1 output 0: timer b1 output 0 p87 tb1out1 1 io o port 87: i/o port 16-bit timer 1 output 1: timer b1 output 1 p90 txd0 1 io o port 90: i/o port serial send data 0 p91 rxd0 1 io i port 91: i/o port serial receive data 0 p92 sclk0 cts0 1 io io i port 92: i/o port serial clock i/o 0 serial data send enable 0 (clear to send) p93 txd1 1 io o port 93: i/o port serial send data 1 p94 rxd1 1 io i port 94: i/o port serial receive data 1 table 1-1 pin names and functions(2/3) pin name pin number input / output functions
page 8 2007-10-15 tmp91fw60 note: all pins that have built-in pull-up resistors (other than the reset pin) can be disconnected from the built-in pull-up resistor by software. p95 sclk1 cts1 1 io io i port 95: i/o port serial clock i/o 1 serial data send enable 1 (clear to send) p96 xt1 1 io i port 96: i/o port low-frequency oscillator connection pin p97 xt2 1 io o port 97: i/o port low-frequency oscillator connection pin pa0 tb2in0 int1 1 io i i port a0: i/o port 16-bit timer 2 input 0:timer b2 count/capture trigger input 0 interrupt request pin 1: interrupt request pin with programmable rising edge / falling edge. pa1 tb2in1 int2 1 io i i port a1: i/o port 16-bit timer 2 input 1:timer b2 count/capture trigger input 1 interrupt request pin 2: interrupt request on rising edge pa2 tb2out0 1 io o port a2: i/o port 16-bit timer 2 output 0: timer b2 output 0 pa3 tb2out1 1 io o port a3: i/o port 16-bit timer 2 output 1: timer b2 output 1 pb0 tb4in0 int9 sda1 1 io i i io port b0: i/o port 16-bit timer 4 input 0:timer b4 count/capture trigger input 0 interrupt request pin 9: interrupt request pin with programmable rising edge / falling edge. serial bus interface data 1 in i2c bus mode. pb1 tb4in1 int10 scl1 1 io i i io port b1: i/o port 16-bit timer 4 input 1:timer b4 count/capture trigger input 1 interrupt request pin 10: interrupt request on rising edge serial bus interface clock 1 in i2c bus mode. pb2 tb4out0 1 io o port b2: i/o port 16-bit timer 4 output 0: timer b4 output 0 pb3 tb4out1 1 io o port b3: i/o port 16-bit timer 4 output 1: timer b4 output 1 nmi 1i non-maskable interrupt request pin: interrupt request pin with programmable falling edge or both edge. am0-1 2 i operation mode:fixed to am1 "1", am0 "1". emu0-1 2 o set to open pins reset 1 i reset: initializes tmp91fw60. (with pull-up resistor) vrefh 1 i pin for reference voltage input to ad converter avcc 1 power supply pin for ad converter avss 1 gnd pin for ad converter (0 v) x1/x2 2 io high frequency oscillator connection pins dvcc 3 power supply pins (all dvcc pins should be connected with the power supply pin.) dvss 3 gnd pins (0 v) (all dvss pins should be connected with the gnd (0v) pin.) table 1-1 pin names and functions(3/3) pin name pin number input / output functions
page 9 2007-10-15 tmp91fw60 2. cpu the tmp91fw60 incorporates a high-performance 16-bit cpu (the 900/l1-cpu). for cpu operation, see the "tlcs-900/l1 cpu". the following describe the unique function of the cpu us ed in the tmp91fw60; thes e functions are not covered in the tlcs-900/l1 cpu section. 2.1 reset when resetting the tmp91fw60 microcontroller, ensure that the power supply voltage is within the operating voltage range, and that the internal high-fre quency oscillator has stabilized. then hold the reset input to low level at least for 10 system clocks (1us at 20 mhz). thus, when turn on the switch, be set to the power supply voltage is within the operating voltage range, and that the internal high-frequency oscillator has stabilized. then hold the reset input to low level at least for 10 system clocks. it means that the system clock mode f sys is set to fc/2. when the reset is accept, the cpu: 1. sets as follows the prog ram counter (pc) in accordance with the reset vector stored at address ffff00h to ffff02h: - pc (7:0) <- value at ffff00h address - pc (15:8) <- value at ffff01h address - pc (23:16) <- value at ffff02h address 2. sets the stack pointer (xsp) to 100h. 3. sets bits of the status register (sr) to 111 (sets the interrupt level mask register to level 7). 4. sets the bit of the status register (sr) to 1 (max mode). 5. clears bits of the st atus register (sr) to 000 (sets the register bank to 0). when reset is released, the cpu starts executing instru ctions in accordance with th e program counter settings. cpu internal registers not mentioned above do not change when the reset is released. when the reset is accepted, the cpu sets intern al i/o, ports, and ot her pins as follows. 1. initializes the internal i/o registers. 2. sets the port pins, including the pins that also act as internal i/o, to general-purpose input or output port mode. 3. sets ale pin to high impedance. note 1: the cpu internal register (except to pc, sr, xsp in cpu) and internal ram data do not change by resetting. note 2: it is necessary to re-set up a stack pointer xsp by the user program. figure 2-1 is a reset timi ng chart of the tmp91fw60.
page 10 2007-10-15 tmp91fw60 figure 2-1 tmp91fw60 reset timing chart data-out f fph a16~a23 ale ad0~ad15 ad0~ad15 (p20 to p27 input mode)  (p40 to p43 input mode)  (pz3 input mode)
#hvgttgugvtgngcugfuvctvkpiyckvu tgcfe[eng 2wnnwr
+pvgtpcn  *kijkorgfcpeg  pz0 pz1 pz2,pz3, p40~p43 p00~p07, p10~p17, p20~p27, p60~p67, p70~p75, p80~p87, p90~p97, pa0~pa3 pb0~pb3 rese t r/ w rd w r hw r cs0 cs3 (p44 input mode)  4gcf 9tkvg sampling sampling (p00 to p07, p10 to p17 input mode) (p00 to p07, p10 to p17 input mode) (p30 output mode) (p31 output mode) (p32 input mode) (input mode) (input mode) (output mode) address address address address
page 11 2007-10-15 tmp91fw60 2.2 memory map figure 2-2 is a memory map of the tmp91fw60. figure 2-2 tmp91fw60 memory map 000000h 001000h 16-mbyte area (r) ( ? r) (r + ) (r + r8/16) (r + d8/16) (nnn) (n) 64 kbyte area (nn) 128 kbyte internal i/o (4 kbytes) internal ram (8 kbytes) 003000h 010000h fe0000h ffff00h ffffffh 000100h
page 12 2007-10-15 tmp91fw60 2.3 system clock function and standby control tmp91fw60 contains a clock gear, stand- by controller and noise-reduction circ uit. it is used for low-noise sys- tems. the clock operating modes are as follows: (a) single clock mode (x1 and x2 pins only), (b) dual clock mode (x1,x2,xt1 and xt2 pins). figure 2-3 shows a transition figure. figure 2-3 tmp91fw60 clock operating mode note: the clock frequency input from the x1 and x2 pins is called f osch and the clock frequency input from the xt1 and xt2 pins is called fs. the clock freque ncy selected by syscr1 is called f fph . the system clock f sys is defined as the divided clock of f fph , and one cycle of f sys is regret to as one state. 4gugv (f osch /2) 4gngcug +puvtwevkqp +pvgttwrv stop mode (stops all circuits) normal mode (f osch /gear value/2) idle2 mode (i/o operate) (operate only oscillator) (a) single clock mode transition figure slow mode (fs/2)   (f osch /2) idle1 mode +puvtwevkqp +pvgttwrv +puvtwevkqp +pvgttwrv 4gugv 4gngcug normal mode (f osch /gear value/2) +puvtwevkqp +puvtwevkqp +pvgttwrv stop mode (stops all circuits) +puvtwevkqp +puvtwevkqp +pvgttwrv +puvtwevkqp +pvgttwrv +puvtwevkqp +pvgttwrv +puvtwevkqp +pvgttwrv (b) dual clock mode transition figure idle2 mode (i/o operate) (operate only oscillator) idle1 mode idle2 mode (i/o operate) (operate only oscillator) idle1 mode
page 13 2007-10-15 tmp91fw60 2.3.1 block diagram of system clock figure 2-4 block diagr am of system clock f fph %nqemigct syscr1 p40 tmra01 to tmra45 syscr0 fs f osch xt1 xt2 syscr0 syscr0 syscr2   x1 x2     fc/16 fc/8 fc/4 fc/2 fc syscr1 4 fc/16 f fph f sys ? 2 f sys cpu rom ram +pvgttwrv eqpvtqnngt wdt i/o port t0 tmrb0 totmrb4 sio0 to sio2 46% fs f syscr2 t0 fs syscr0 sbi0 to sbi1 5;5 warm-up timer low- frequency oscillator high- frequency oscillator (for high/low frequency oscillator) adc prescaler prescaler prescaler prescaler binary counter
page 14 2007-10-15 tmp91fw60 2.3.2 sfr note 1: "-" = don?t care note 2: syscr0,syscr1,syscr2 are read as undefined value. note 3: as for the serial channels sio0, sio1 and sio2, a baud rate generator is unavailable as an input clock of an i/o interf ace and a clock for a serial transfer if a prescaler clock is set to fc/16 when syscr0 is "1". table 2-1 sfr for system clock 76543210 syscr0 (00e0h) bit symbol xen xten rxen rxten rsysck wuef prck1 ? read/write r/w ? after reset1010000 ? function high- frequency oscillator 0:stop 1:oscillation low- frequency oscillator 0:stop 1:oscillation high- frequency oscillator (fc) after release of stop mode 0:stop 1:oscillation low- frequency oscillator (fs) after release of stop mode 0:stop 1:oscillation selects clock after release of stop mode 0:fc 1:fs warm-up timer control 0 write: don't care 1 write: start warm- up 0 read: end warm- up 1 read: do not end warm-up select pres- caler clock 0:f fph 1:fc/16 syscr1 (00e1h) bit symbol ???? sysck gear2 gear1 gear0 read/write ???? r/w after reset ???? 0000 function ???? select sys- tem clock 0: fc 1: fs select gear value of high frequency (fc) 000:fc 001:fc/2 010:fc/4 011:fc/8 100:fc/16 101:reserved 110:reserved 111:reserved syscr2 (00e2h) bit symbol ? scosel wuptm1 wuptm0 haltm1 haltm0 ? drve read/write ? r/w ? r/w after reset ? 01011 ? 0 function ? select scout 0:fs 1:f sys select warm-up time for oscillator 00:2 18 /inputted frequency 01:2 8 /inputted frequency 10:2 14 /inputted frequency 11:2 16 /inputted frequency halt mode 00:reserved 01:stop mode 10:idle1 mode 11:idle2 mode ? pin state control in stop mode 0: i/o off 1: remains the state before halt
page 15 2007-10-15 tmp91fw60 2.3.3 system clock controller the system clock controller gene rates the system clock signal (f sys ) for the cpu core and internal i/o.it contains two oscillation circuits and a clock gear circuit for high-frequency (fc) operation. the register syscr1 changes the system clock to either fc or fs, syscr0 and syscr0 con- trol enabling and disabling of each oscillator, and syscr1 sets the high-frequen cy clock gear to either 1, 2, 4, 8 or 16 (fc, fc/2, fc/4, fc/8 or fc/ 16). these functions can reduce the power consumption of the equipment in which the device is installed. the combination of settings = "1", = "0", = "0" and = "000" will cause the system clock (f sys ) to be set to fc/2 (=fc x 1/2) after a reset. for example, f sys is set to 8 mhz when the 16 mhz oscillator connected to the x1 and x2 pins. (1) switching from normal mode to slow mode when the resonator is connected to the x1 and x2 pins, or to the xt1 and xt2 pins, the warm-up timer can be used to change the operation frequenc y after stable oscillation has been attained. the warm-up time can be selected using syscr2. this warm-up timer can be programmed to start and stop as shown in the following examples 1 and 2. table 2-2 shows the warm-up time. note 1: when using an oscillator (other than a resonator) with stable oscillation, a warm-up timer is not needed. note 2: the warm-up timer is operat ed by an oscillation clock. hence, th ere may be some variation in warm-up time. note 3: note of using low-frequency oscillator when connect low-frequency oscillator to ports 96 and 97, need below setting for cut consumption power. (case of resonators) set p9cr = "11", p9 = "00" (case of oscillator) set p9cr = "11", p9 = "10" note: at f osch =20mhz fs=32.768khz table 2-2 warm-up times (when changing clock) select warm-up time syscr2 change to normal (fc) change to slow (fs) 01(2 8 /frequency) 12.8[us] 7.8[ms] 10(2 14 /frequency) 0.819[ms] 500[ms] 11(2 16 /frequency) 3.277[ms] 2000[ms] 00(2 18 /frequency) 13.107[ms] 8000[ms]
page 16 2007-10-15 tmp91fw60 example 1: note: x: don?t care, -:no change figure 2-5 changing from high frequency (fc) to low frequency (fs) changing from high frequency (fc) to low frequency (fs). syscr0 equ 00e0h syscr1 equ 00e1h syscr2 equ 00e2h ld (syscr2),x-11--x-b ; sets warm-up time to 2 16 /fs. set 6,(syscr0) ; enables low-frequency oscillation. set 2,(syscr0) ; clears and starts warm-up timer. wup: bit 2,(syscr0) ; detects stopping of warm-up timer. jr nz,wup ; set 3,(syscr1) ; changes f sys from fc to fs. res 7,(syscr0) ; disables high-frequency oscillation. x1 and x2 pins f sys f sys xt1 and xt2 pins counts up by counts up by fs
page 17 2007-10-15 tmp91fw60 example 2: note: x: don?t care, -:no change figure 2-6 changing from low frequency (fs) to high frequency (fc) (2) clock gear controller when the high-frequency cl ock fc is selected by setting syscr1 = "0", f fph is set according to the contents of the clock gear se lect register syscr1 to either fc, fc/2, fc/4, fc/8 or fc/16. using the clock gear to select a lower value of f fph reduces power consumption. below show example of changing clock gear. changing from low frequency (fs) to high frequency (fc). syscr0 equ 00e0h syscr1 equ 00e1h syscr2 equ 00e2h ld (syscr2),x-10--x-b ; sets warm-up time to 2 14 /fc. set 7,(syscr0) ; enables high-frequency oscillation. set 2,(syscr0) ; clears and starts warm-up timer. wup: bit 2,(syscr0) ; detects stopping of warm-up timer. jr nz,wup ; res 3,(syscr1) ; changes f sys from fs to fc res 6,(syscr0) ; disables low-frequency oscillation. x1 and x2 pins xt1 and xt2 pin2 f sys f sys counts up by counts up by fc
page 18 2007-10-15 tmp91fw60 example 3: x:don?t care (clock gear changing) to change the clock gear, write the register value to the syscr1 regist er. it is necessary the warm-up time until changing afte r writing the register value. there is the possibility that the instruction next to the clock gear changing inst ruction is executed by the clock gear before changing. to execute the instruction next to the clock g ear switching instruction by the clock gear after changing, input the dumm y instruction as follows (instruc tion to execute the write cycle). (3)internal clock output the f sys or fs internal clock can be driven out from the p40/scout pin. the p40/scout pin is configured as scout (sys tem clock output) by programming the port 4 regis- ters as follows: p4cr = "1" and p4fc = "1". the output clock is selected through the syscr2 bit. table 2-3 shows the pin states in each clocking mode when the p40/scout pin is configured as scout. 2.3.4 prescaler clock controller for the internal i/o (tmra01 to tmra45, tmrb0 to tmrb4, sio0 to sio2, sbi0, sbi1) there is a prescaler which can divide the clock. the t0 clock input to the prescal er is either the clock f fph divided by 2 or the clock fc/16 divided by 4. the setting of the syscr0 register determines which clock signal is input. changing to a clock gear syscr1 equ 00e1h ld (syscr1),xxxx0000b ; changes f sys to fc/2. syscr1 equ 00e1h ld (syscr1),xxxx0000b ; changes f sys to fc/2. ld (dummy),00h ; dummy instruction instruction to be executed after clock gear has changed. table 2-3 scout output states normal slow halt mode idle2 idle1 stop ="0" the fs clock is driven out. hold at either "1" or "0" ="1" the f sys clock is driven out.
page 19 2007-10-15 tmp91fw60 2.3.5 runaway provision wi th sfr protection register (purpose) provision in runaway of program by noise mixing. write operation to specified sfr is prohibited so that provision program in runaway prevents that it is it in the state which is fetch impossibility by stopping of clock, memory control register (cs/wait controller) is changed. specified sfr list (block diagram) (setting method) if writing except "1fh" code to emccr1 register, it become protect on. by this operation, write operation to specified sfr is disabling. if writing "1fh" to emccr1 register, it become protect off. state of protect can to confirm by reading emccr0. 1. cs/wait controller b0cs, b1cs, b2cs, b3cs, bexcs, msar0, msar1, msar2, msar3, mamr0, mamr1, mamr2, mamr3 2. clock gear (write enable only emccr1) syscr0, syscr1, syscr2 table 2-4 sfr for emccr 76543210 emccr0 (00e3h) bit symbol protect ??????? read/write r r/w after reset00100011 function protect flag 0: off 1: on write "0". write "1". write "0". write "0". write "0". write "1". write "1". emccr1 (00e4h) bit symbol protect off by writing "1fh". protect on by writing except "1fh". read/write after reset function emccr0 sq r write signal to sfr
page 20 2007-10-15 tmp91fw60 2.3.6 standby controller (1)halt modes when the halt instruction is executed, the operatin g mode switches to idle2, idle1 or stop mode, depending on the contents of the syscr2 register. the subsequent actions performe d in each mode are as follows: 1. idle2: only the cpu halts. the internal i/o is available to select operation during idle2 mode by setting the following register. shows the registers of setting operation during idle2 mode. 2. idle1: only the oscillator and the rtc (real time clock) continue to operate. 3. stop: all internal circuits stop operating. the operation of each of the different halt modes is described in table 2-6. table 2-5 sfr setting operation during idle2 mode internal i/o sfr internal i/o sfr tmra01 ta01run sio0 sc0mod1 tmra23 ta23run sio1 sc1mod1 tmra45 ta45run sio2 sc2mod1 tmrb0 tb0run sbi0 sbi0br tmrb1 tb1run sbi1 sbi1br tmrb2 tb2run ad adccr2 tmrb3 tb3run wdt wdmod tmrb4 tb4run table 2-6 i/o operation during halt modes halt mode idle2 idle1 stop syscr2 11 10 01 block cpu stop i/o port keep the state when the halt instruction was executed. see table 2-9 tmra,tmrb available to select operation block rtc operate enable sio,sbi stop ad wdt interrupt controller operate
page 21 2007-10-15 tmp91fw60 (2)how to release the halt mode these halt states can be released by resetting or requesting an interrupt. the halt release sources are determined by the combination between the states of interrupt mask register and the halt modes. the details for releasing the halt status are shown in table 2-7. released by reques ting an interrupt the operating released from the halt mode depends on the interrupt enabled status. when the inter- rupt request level set before execu ting the halt instruction exceeds the value of interrupt mask register, the interrupt due to the source is processed after releasing the halt mode, and cpu status executing an instruction that follows the halt instruction. when the interrupt request level set before executing the halt instruction is less than the value of the inte rrupt mask register, releasing the halt mode is not executed. (in non-maskable interrupts, interrupt pro cessing is processed after releasing the halt mode regardless of the value of the mask register.) however only for int0 and rtc interrupts, even if the inter- rupt request level set before executing the halt inst ruction is less than the value of the interrupt mask register, releasing the halt mode is executed. in th is case, interrupt processing, and cpu starts execut- ing the instruction next to the halt instruction, but the interrupt request flag is held at "1". note:usually, interrupts can release all halts status. however, the interrupts ( nmi , int0, intrtc) which can release the halt mode may not be able to do so if they are input during the period cpu is shifting to the halt mode (for about 5 clocks of f fph ) with idle1 or stop mode (idle2 is not applicable to this case). (in this case, an interrupt request is kept on hold internally.) if another interrupt is generated after it has shifted to halt mode completely, halt status can be released wi thout difficulty. the priority of this interrupt is compared with that of the interrupt kept on hold internally, and the interrupt wi th higher priority is handled first followed by the other interrupt. releasing by resetting releasing all halt status is executed by resetting. when the stop mode is released by reset, it is necessary enough resetting time (see table 2-6)to set the operation of the osci llator to be stable. when releasing the halt mode by resetting, the in ternal ram data keeps the state before the "halt" instruction is executed. however the other settings contents are initialized. (releasing due to interrupts keeps the state before the "halt" instruction is executed.)
page 22 2007-10-15 tmp91fw60 ? :after clearing the halt mode, cpu starts interrupt processing. :after clearing the halt mode, cpu resumes execu ting starting from instruction following the halt instruction. (interrupt routine don't execute.) :it can not be used to release the halt mode. - :the priority level (interrupt request level) of non-maskable interrupts is fixed to 7, the highest priority level. there is not this combination type. *1:releasing the halt mode is execu ted after passing the warm-up time. note 1: when the halt mode is cleared by an int0 interrupt of the level mode in the interrupt enabled status, hold high level until starting interrupt process. if low leve l was set before interrupt process is stared, interrupt process is not started correctly. note 2: if using external interrupt int1 to int10 in idle2 mode, set 16-bit timer run register tb0run, tb1run, tb2run, tb3run, tb4run to "1". table 2-7 source of halt state clearance and halt clearance operation status of received interrupt interrupt enable (interrupt level) (interrupt mask) interrupt disable (interrupt level) < (interrupt mask) halt mode idle2 idle1 stop idle2 idle1 stop source of halt state clearance interrupt nmi ??? *1 -- - intwdt ? -- - int0(note 1) ??? *1 ?? *1 intrtc ?? int1-int10 ? (note 2) intta0-intta5 ? inttb00-40,inttb01-41 ? inttb0f0-4 ? intrx0-intrx2,tx0-tx2 ? intsbi0-1 ? intad ? reset initialize lsi
page 23 2007-10-15 tmp91fw60 example:clearing halt state an int0 interrupt clears the halt stat e when the device is in idle1 mode. (3)operation 1. idle2 mode in idle2 mode only specific intern al i/o operations, as designated by the idle2 setting register, can take place. instruction execution by the cpu stops. figure 2-7 illustrates an example of the timing for clearance of the idle2 mode halt state by an inter- rupt. figure 2-7 timing chart for idle2 mode halt stat e cleared by interrupt #fftguu 8203h ld (iimc), 00h ; selects int0 interrupt rising edge. 8206h ld (inte0ad), 06h ; sets int0 interrupt level to 6. 8209h ei 5 ; sets cpu interrupt level to 5. 820bh ld (syscr2), 28h ; sets halt mode to idle1 mode. 820eh halt ; halts cpu. int0 int0 interrupt routine reti 820fh ld xx, xx x1 a0~a23 rd wr ad0~ad15 idle2 ale address address address data data
page 24 2007-10-15 tmp91fw60 2. idle1 mode in idle1 mode, only the internal oscillator and the rtc continue to operate. the system clock in the mcu stops. in the halt state, the interrupt request is sampled as ynchronously with the syst em clock; however, clear- ance of the halt state (e .g., restart of operation) is synchronous with it. figure 2-8 illustrates the timi ng for clearance of the idle1 mode halt state by an interrupt. figure 2-8 timing chart for idle1 mode halt stat e cleared by interrupt x1 a0 a23 rd wr idle1 mode ad0 ad15 ale address address data data
page 25 2007-10-15 tmp91fw60 3. stop mode when stop mode is selected, all internal circuits stop, including the internal oscillator. pin status in stop mode depends on the settings in the syscr2 register. table 2-9 summarizes the state of these pins in stop mode. after stop mode has been cleared, system clock output starts when the warm-up time has elapsed, in order to allow oscillation to st abilize. after stop mode has b een cleared, either normal mode or slow mode can be selected us ing the syscr0 register . therefore, , and must be set. see the sample warm-up times in table 2-8. figure 2-9 illustrates the timi ng for clearance of the stop mode halt state by an interrupt. figure 2-9 timing chart for stop mo de halt state cleared by interrupt note: f osch =20mhz, fs=32.768khz table 2-8 sample warm-up times after clearance of stop mode syscr0 syscr2 01(2 8 )10(2 14 )11(2 16 ) 00(2 18 ) 0(fc) 12.8us 0.819ms 3.277ms 13.107ms 1(fs) 7.8ms 500ms 2000ms 8000ms stop x1 a0 a23 rd wr ad0 ad15 ale address address data data
page 26 2007-10-15 tmp91fw60 example: "the stop mode is entered when the low-frequency operates, and high-frequency operates after releas- ing due to nmi. note:when different modes are used before and after stop mode as the above mentioned, there is possible to release the halt mode without changing the operation mode by acceptance of the halt release interrupt request during execution of "halt" inst ruction (during 6 state). in the system which accepts the interrupts dur- ing execution "halt" instruction, set the same operation mode before and after the stop mode. syscr0 equ 00e0h syscr1 equ 00e1h syscr2 equ 00e2h 8ffdh ld (syscr1), 08h ; f sys = fs/2 9000h ld (syscr2), x ? 1001x1b ; 2 14 /f osch 9002h ld (syscr0), 011000 ? ? b ; 9005h halt 9006h ld xx, xx reti ? : no change nmi nmi
page 27 2007-10-15 tmp91fw60 - : input for input mode / input pins is invalid; output mode / output pin is at high impedance. input: input gate in operation. fix input voltage to "l" or "h" so that input pin stays constant. output: output state pu*: programmable pull-up pin. input gate disable state. no through current even if the pin is set high impedance. table 2-9 input/output buffer state table port name input / output =0 =1 p00-07 input mode output mode ad0-ad7 - - - - output - p10-17 input mode output mode ad8-ad15 - - - - output - p20-27 input mode output mode,a0-a7/a16-a23 - - - output pz0(rd ),pz1(wr ) output - output pz2(hwr ),pz3(r/w ) input mode output mode pu* pu* pu* output p30-33 input mode output mode - - - output p40-44 input mode output mode pu* pu* pu* output p50-57 input mode output mode analog input - - - - output - p60-67 input mode output mode analog input - - - - output - p70-74 input mode output mode - - input output p75 input mode output mode input - input output p80-87 input mode output mode - - - output p90-97 input mode output mode - - - output pa0-a3 input mode output mode - - - output pb0-b3 input mode output mode - - - output nmi input input input reset input input input am0,am1 input input input x1 input - - x2 output "h" level output "h" level output
page 28 2007-10-15 tmp91fw60 3. interrupts interrupts are controlled by the cpu interrupt mask regi ster sr and by the built-in interrupt controller. the tmp91fw60 has a total of 57 interrupts divided into the following three types: ? interrupts generated by cpu: 9 sources (software interrupts, ille gal instruction interrupt) ? interrupts on external pins ( nmi , int0 to int10): 12 sources ? internal interrupts: 36 sources a (fixed) individual inte rrupt vector number is a ssigned to each interrupt. one of six (variable) priority level can be assigned to each maskable interrupt. the priority level of non-maskable interr upts are fixed at 7 as the highest level. when an interrupt is generated, the inte rrupt controller sends the priority of that interrupt to the cpu. if multiple interrupts are generated simultaneously, the interrupt contro ller sends the interrupt with the highest priority to the cpu. (the highest priority is level 7 using for non-maskable interrupts.) the cpu compares the priority level of the interrupt with the value of the cpu interrupt mask register . if the priority level of the interrupt is higher than the value of the interrupt mask register, the cpu accepts the inter- rupt. the interrupt mask register value can be update d using the value of the ei instruction ("ei num" sets data to num). for example, specifying "ei3" enables the maskable interrupts which priority le vel set in the interrupt controller is 3 or higher, and also non-maskable interrupts. operationally, the di instructio n ( "7") is identical to the "ei7" instruction. di instruction is used to dis- able maskable interrupts because of the priority level of maskable interrupts is 0 to 6. th e ei instruction is valid immediately after execution. in addition to the above general-purpose interrupt pr ocessing mode, tlcs-900/l1 has a micro dma interrupt processing mode as well. the cpu can tr ansfer the data (1/2/4 bytes) automa tically in micro dm a mode, therefore this mode is used for speed-up interrupt processing, such as transferring data to the intern al or external peripheral i/ o. moreover, tmp91fw60 has software start function for micro dma processing request by the software not by the hardware interrupt. figure 3-1 shows the overall interrupt processing flow.
page 29 2007-10-15 tmp91fw60 figure 3-1 overall inte rrupt processing flow interrupt vector value "v" read interrupt request f/f clear clear vector register generating micro dma transfer and interrupt (inttc0 to inttc3) push pc push sr sr level of accepted interrupt + 1 intnest intnest + 1 reti instruction pop sr pop pc intnest intnest ? 1 data transfer by micro dma interrupt processing program pc (ffff00h + v) interrupt specified by micro dma start vector? count = 0 general-purpose interrupt processing micro dma processing interrupt processing end no no yes yes clear interrupt request flag count count ? 1 micro dma soft start request
page 30 2007-10-15 tmp91fw60 3.1 general-purpose interrupt processing when the cpu accepts an interr upt, it usually performs the following sequence of operatio ns. that is also the same as tlcs-900/l and tlcs-900/h. 1. the cpu reads the inte rrupt vector from the interrupt controller. if the same level interrupts occur simultaneously, the in terrupt controller generates an interrupt vector in accordance with the defau lt priority and clears the interrupt request. (the default priority is already fi xed for each interrupt. the smaller v ector value has the higher priority level.) 2. the cpu pushes the value of progra m counter (pc) and status register (sr) onto the stack area (indicated by xsp). 3. the cpu sets the value which is the prior ity level of the accepted interrupt plus 1 ( + 1) to the interrupt mask register . however, if the pr iority level of the accepted interrupt is 7, the register?s value is set to 7. 4. the cpu increases the interrupt nesting counter intnest by 1 ( + 1). 5. the cpu jumps to the address indicated by the data at address ?ffff00h + interr upt vector? and starts the interrupt processing routine. the above processing time is 18 states (1.8 s at 20 mhz) as the best case (16-bit data bus width and 0 waits). when the cpu completed the interrupt pr ocessing, use the reti instruction to return to the main routine. reti restores the contents of program counte r (pc) and status register (sr) from the stack and decreases the interrupt nesting counter intnest by 1 ( ? 1). non-maskable interrupts cannot be disabled by a user prog ram. maskable interrupts, however, can be enabled or disabled by a user program. a program can set the priority level for each interr upt source. (a prior ity level setting of 0 or 7 will disable an interrupt request.) if an interrupt request which has a priority level equal to or greater than the value of the cpu interrupt mask regis- ter comes out, the cpu accepts it s interrupt. then, the cpu interrupt ma sk register is set to the value of the priority level fo r the accepted interrupt plus 1 ( + 1). therefore, if an interrupt is generated with a higher leve l than the current interrupt during its processing, the cpu accepts the later interrupt and goes to the nesting status of interrupt processing. moreover, if the cpu receives another interrupt request while performing the said 1. to 5. processing steps of the current interrupt, the latest interrupt request is sampled i mmediately after execution of the first instruction of the cur- rent interrupt processing routine. specifying di as the start instruction disables maskable interrupt nesting. a reset initializes the interrupt mask register to ?111?, disabling all maskable interrupts. table 3-1 shows the tmp91fw60 interrupt vectors and micr o dma start vectors. the address ffff00h to ffffffh (256 bytes) is assigne d for the interrupt vector area.
page 31 2007-10-15 tmp91fw60 table 3-1 tmp91fw60 interrupt vectors table(1/2) default priority type interrupt source and source of micro dma request vector value (v) vector refer- ence address micro dma start vector 1 non- maskable ?reset? or ?swi 0? instruction 0000h ffff00h ? 2 ?swi 1? instruction 0004h ffff04h ? 3 intundef: illegal instruction or ?swi 2? instruction 0008h ffff08h ? 4 ?swi 3? instruction 000ch ffff0ch ? 5 ?swi 4? instruction 0010h ffff10h ? 6 ?swi 5? instruction 0014h ffff14h ? 7 ?swi 6? instruction 0018h ffff18h ? 8 ?swi 7? instruction 001ch ffff1ch ? 9 nmi :nmi pin 0020h ffff20h ? 10 intwd: watchdog timer 0024h ffff24h ? ? maskable micro dma (mdma) ? ? ? 11 int0: int0 pin 0028h ffff28h 0ah 12 int1: int1 pin 002ch ffff2ch 0bh 13 int2: int2 pin 0030h ffff30h 0ch 14 int3: int3 pin 0034h ffff34h 0dh 15 int4: int4 pin 0038h ffff38h 0eh 16 int5: int5 pin 003ch ffff3ch 0fh 17 int6: int6 pin 0040h ffff40h 10h 18 int7: int7 pin 0044h ffff44h 11h 19 int8: int8 pin 0048h ffff48h 12h 20 int9: int9 pin 004ch ffff4ch 13h 21 int10: int10 pin 0050h ffff50h 14h 22 intta0: 8-bit timer 0 0054h ffff54h 15h 23 intta1: 8-bit timer 1 0058h ffff58h 16h 24 intta2: 8-bit timer 2 005ch ffff5ch 17h 25 intta3: 8-bit timer 3 0060h ffff60h 18h 26 intta4: 8-bit timer 4 0064h ffff64h 19h 27 intta5: 8-bit timer 5 0068h ffff68h 1ah 28 inttb00: 16-bit timer 0 (tb0rg0) 006ch ffff6ch 1bh 29 inttb01: 16-bit timer 0 (tb0rg1) 0070h ffff70h 1ch 30 inttb10: 16-bit timer 1 (tb1rg0) 0074h ffff74h 1dh 31 inttb11: 16-bit timer 1 (tb1rg1) 0078h ffff78h 1eh 32 inttb20: 16-bit timer 2 (tb2rg0) 007ch ffff7ch 1fh 33 inttb21: 16-bit timer 2 (tb2rg1) 0080h ffff80h 20h 34 inttb30: 16-bit timer 3 (tb3rg0) 0084h ffff84h 21h 35 inttb31: 16-bit timer 3 (tb3rg1) 0088h ffff88h 22h 36 inttb40: 16-bit timer 4 (tb4rg0) 008ch ffff8ch 23h 37 inttb41: 16-bit timer 4 (tb4rg1) 0090h ffff90h 24h
page 32 2007-10-15 tmp91fw60 note: micro dma default priority: micro dma stands up prior to other maskable interrupt. 38 maskable inttbof0: 16-bit timer 0 (over flow) 0094h ffff94h 25h 39 inttbof1: 16-bit timer 1 (over flow) 0098h ffff98h 26h 40 inttbof2: 16-bit timer 2 (over flow) 009ch ffff9ch 27h 41 inttbof3: 16-bit timer 3 (over flow) 00a0h ffffa0h 28h 42 inttbof4: 16-bit timer 4 (over flow) 00a4h ffffa4h 29h 43 intrx0:serial reception (channel 0) 00a8h ffffa8h 2ah 44 inttx0:serial transmission (channel 0) 00ach ffffach 2bh 45 intrx1:serial reception (channel 1) 00b0h ffffb0h 2ch 46 inttx1:serial transmission (channel 1) 00b4h ffffb4h 2dh 47 intrx2:serial reception (channel 2) 00b8h ffffb8h 2eh 48 inttx2:serial transmission (channel 2) 00bch ffffbch 2fh 49 intsbi0:serial bus interface interrupt (channel 0) 00c0h ffffc0h 30h 50 intsbi1:serial bus interface interrupt (channel 1) 00c4h ffffc4h 31h 51 intrtc: interrupt for special timer for clock 00c8h ffffc8h 32h 52 intad: ad conversion end 00cch ffffcch 33h 53 inttc0 micro dma end (channel 0) 00d0h ffffd0h ? 54 inttc1: micro dma end (channel 1) 00d4h ffffd4h ? 55 inttc2: micro dma end (channel 2) 00d8h ffffd8h ? 56 inttc3: micro dma end (channel 3) 00dch ffffdch ? (reserved) : (reserved) 00e0h : 00fch ffffe0h : fffffch ? : ? table 3-1 tmp91fw60 interrupt vectors table(2/2) default priority type interrupt source and source of micro dma request vector value (v) vector refer- ence address micro dma start vector
page 33 2007-10-15 tmp91fw60 3.2 micro dma processing in addition to general-purpose interrupt processing, th e tmp91fw60 supports a micro dma function. interrupt requests set by micro dma perform micro dma processing at the highest priority leve l (level 6) among maskable interrupts, regardless of the priority level of the partic ular interrupt source. the mi cro dma has 4 channels and is possible continuous transmission by specifying the described later burst mode. the micro dma has 4 channels and is possible continuous transmission by specifying the described later burst mode. because the micro dma function has been implemented with the cooperative operation of cpu, when cpu goes to a standby mode (stop, idle1 and idle2) by halt inst ruction, the requirement of micro dma will be ignored (pending) and dma transfer is started after release halt. 3.2.1 micro dma operation when an interrupt request specified by the micro dma start vector register is generated, the micro dma triggers a micro dma request to the cpu at interrupt prio rity level 6 and starts processing the request in spite of any interrupt source?s level. the micro dma is ignored on = ?7?. the 4 micro dma channels allow micro dma processing to be set for up to 4 types of interrupts at any one time. when micro dma is accepted, the interrupt request f lip-flop assigned to that channel is cleared. the data are automatically transferre d once (1/2/4 bytes) from the transfer source addre ss to the transfer des- tination address set in the control register, and the transfer counter is decreased by 1 ( ? 1). if the decreased result is ?0?, the micro dma transf er end interrupt (inttc0 to inttc3) passes from the cpu to the interrupt controller. in addition, the micro dm a start vector register dmanv is cl eared to 0, the next micro dma is disabled and micro dma processing co mpletes. if the decreased result is other than ?0?, the micro dma pro- cessing completes if it does not specify the described later burst mode. in this case, the micro dma transfer end interrupt (inttc0 to inttc3) aren?t generated. if an interrupt request is triggered for the interrupt source in use during the inte rval between the clearing of the micro dma start vector and the next setting, gene ral-purpose interrupt processing executes at the interrupt level set. therefore, if only using the interrupt for starting the micro dm a (not using the interrupts as a gen- eral-purpose interrupt: level 1 to 6), first set the in terrupts level to 0 (interrupt requests disabled). if using micro dma and general-purpose interrupts togeth er, first set the level of the interrupt used to start micro dma processing lower than all the other interrupt le vels. (note) in this case, the cause of general inter- rupt is limited to the edge interrupt. the priority of the micro dma transfer end interrupt (inttc0 to inttc3) is defined by the interrupt level and the default priority as the same as the other maskable interrupt. if a micro dma request is set for mo re than one channel at the same time, the priority is not based on the interrupt priority level but on the channel number. the smaller channel number has the higher priority (chan- nel 0 (high) > channel 3 (low)). while the register for setting the transf er source/transfer destin ation addresses is a 32-bit control register, this register can only effectively outp ut 24-bit addresses. accordingly, micro dma can access 16 mbytes (the upper eight bits of the 32 bits are not valid). note:if the priority level of micro dma is set higher than that of other interrupts, cpu operates as follows. in case intxxx interrupt is generated first and then intyyy interrupt is generated between checking "interrupt specified by micro dma start vector" (in the figure 3-1) and reading interrupt vector with setting below, the vector shifts to that of intyyy at the time. this is because the priority level of intyyy is higher than that of intxxx. in the interrupt routine, cpu reads the vector of intyyy because checking of micro dma has been finished. and intyyy is generated regardless of transfer counter of micro dma. intxxx: level 1 without micro dma intyyy: level 6 with micro dma
page 34 2007-10-15 tmp91fw60 three micro dma transfer modes are supported: 1-byte transfer, 2-byte (one-word) transfer, and 4-byte transfer. after a transfer in any mo de, the transfer source/destination addresses are increased, decreased, or remain unchanged. this simplifies the transfer of data from i/o to memory, from memory to i/o, and from i/o to i/o. for details of the transfer modes, see" 3.2.4 detailed de scription of the transfer mode register ". as the transfer counter is a 16-bit counter, micro dma processing can be set for up to 65536 times per inter- rupt source. (the micro dma processing count is maximi zed when the transfer count er initial value is set to 0000h.) micro dma processing can be started by the 42 interr upts shown in the micro dma start vectors of table 3- 1 and by the micro dma soft start, making a total of 43 interrupts. figure 3-2 shows the word transfer micro dm a cycle in transfer destinatio n address inc mode (except for counter mode, the same as for other modes). (the conditions for this cycle are base d on an external 16-bit bus, 0 waits, transfer source/transfer destination addresses both even-numberd values). figure 3-2 timing for micro dma cycle states 1 to 3: instruction fetch cycle (gets next address code). if 3 bytes and more instruction codes are insert ed in the instruction queue buffer, this cycle becomes a dummy cycle. states 4 to 5: micro dma read cycle state 6: dummy cycle (the address bu s remains unchanged from state 5.) states 7 to 8: micro dma write cycle note 1: if the source address area is an 8- bit bus, it is increased by two states. if the source address area is a 16-bit bus and the address starts from an odd number, it is increased by two states. note 2: if the destination address area is an 8- bit bus, it is increased by two states. if the destination address area is a 16-bit bus and the addr ess starts from an odd number, it is increased by two states. rd x1 a0 to a 23 d0 to d 15 transfer source address transfer destination address input output 1 state dm1 dm2 dm3 dm4 dm5 dm6 dm7 dm8 (note 2) (note 1) wr, hwr
page 35 2007-10-15 tmp91fw60 3.2.2 soft start function in addition to starting the micro dma function by interrupts, tmp91fw60 includes a micro dma software start function that starts micro dma on the gene ration of the write cycle to the dmar register. writing ?1? to each bit of dmar register causes mi cro dma once (if write ?0? to each bit, micro dma doesn?t operate) at the end of transfer, the corresponding bit of the dmar register is automatically cleared to ?0?. only one-channel can be set once for micro dma. (do not write ?1? to plural bits.) when writing again ?1? to the dmar register, check whet her the bit is ?0? before writing ?1?. if read ?1?, micro dma transfer isn?t started yet. when a burst is specified by dmab register, data is continuously transferred unt il the value in the micro dma transfer counter is ?0? after st art up of the micro dma. if execute soft start during micro dma transfer by interrupt source, micro dma transfer counter doesn?t change. don?t use read-modify-write instruction to avoid writing to other bits by mistake. 3.2.3 transfer c ontrol registers the transfer source ad dress and the transfer destin ation address are set in the following registers in cpu. data setting for these registers is done by an ?ldc cr, r? instruction. symbolnameaddress76543210 dmar dma request register 89h rmw instructions are prohib- ited. ? ? ? ? dmar3 dmar2 dmar1 dmar0 ???? r/w ????0000 dma request dmas0 dmad0 dmac0 dmam0 dma source address register 0: only use lsb 24 bits dma destination address register 0: only use lsb 24 bits dma counter register 0: 1 to 65536 dma mode register 0 channel 0 dmas3 dmad3 dmac3 dmam3 dma source address register 3 dma destination address register 3 dma counter register 3 dma mode register 3 channel 3 8 bits 16 bits 32 bits
page 36 2007-10-15 tmp91fw60 3.2.4 detailed desc ription of the tran sfer mode register note 1: ?n? is the correspondi ng micro dma channels 0 to 3. dmadn+/dmasn+: post-increment (increment register value after transfer) dmadn-/dmasn-: post-decrement (decrement register value after transfer) the i/os in the table mean fixed address and the me mory means increment (inc) or decrement (dec) addresses. note 2: execution time is under the condition of: 16-bit bus width (both transfer and destination address area)/0 waits/ fc = 20 mhz/selected high-frequency mode (fc 1) note 3: do not use an undefined code for the transfer mode register except for the defined codes listed in the above table. (dmam0 to dmam3) 0 0 0 mode note: the upper three bit of data programmed to these registers must always be 0. 000zz transfer destination address inc mode ?????????? i/o to memory (dmadn+) (dmasn) dmacn dmacn ? 1 if dmacn = 0 then inttc is generated 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 001zz transfer destination address dec mode ????????? i/o to memory (dmadn-) (dmasn) dmacn dmacn ? 1 if dmacn = 0 then inttc is generated 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 010zz transfer source address int mode ???????????? memory to i/o (dmadn) (dmasn+) dmacn dmacn ? 1 if dmacn = 0 then inttc is generated 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 011zz transfer source address dec mode ??????????? memory to i/o (dmadn) (dmasn-) dmacn dmacn ? 1 if dmacn = 0 then inttc is generated 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 100zz address fixed mode ????????????????????? i/o to i/o (dmadn) (dmasn) dmacn dmacn ? 1 if dmacn = 0 then inttc is generated 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 10100 counter mode for counting number of times interrupt is generated dmasn dmasn + 1 dmacn dmacn ? 1 if dmacn = 0 then inttc is generated 5 states (500 ns) execution time zz: 0 = byte transfer, 1 = word transfer, 2 = 4-byte transfer, 3 = reserved
page 37 2007-10-15 tmp91fw60 3.3 interrupt controller operation the block diagram in figure 3-3 shows the interrupt circuits. the left-hand side of the diagram shows the inter- rupt controller circuit. the right-hand side shows the cpu interrupt request signal circuit and the halt release circuit. for interrupt controller there is an interrupt request flag (c onsisting of a flip-flop), an interrupt priority setting reg- ister and a micro dma start vector register. the interrupt re quest flag latches interrupt requests from the peripherals. the flag is cleared to 0 in the following cases: ? when reset occurs ? when the cpu reads the channel v ector after accepted its interrupt ? when executing an instruction that clears the interrupt (write dma st art vector to intclr register) ? when the cpu receives a micro dma request (when micro dma is set) ? when the micro dma burst transfer is terminated an interrupt priority can be set indepe ndently for each interrupt so urce by writing the prior ity to the interrupt pri- ority setting register (e.g., inte0ad or inte56). 6 interrupt pr iorities levels (1 to 6) are provided. setting an inter- rupt source?s priority level to 0 (or 7) disables interrup t requests from that source. the priority of non-maskable interrupts ( nmi pin interrupts and watchdog timer interrupts) is fixed at 7. if interrupt request with the same level are generated at the same time, the default priority is used to determine which interrupt request is accepted first. the 3rd and 7th bits of the interrupt priority setting regist er indicate the state of the in terrupt request flag and thus whether an interrupt request for a given channel has occurred. the interrupt controller sends the interrupt request and it s vector address to the cpu. the cpu compares the prior- ity value in the status register by the interrupt request signal with the priority value set; if the latter is higher, the interrupt is accepted. then the cpu sets a value higher than th e priority value by 1 ( + 1) in the cpu sr. interrupt re quest where the priority value equals or is higher than th e set value are accepted simulta- neously during the previous interrupt routine. when interrupt processing is completed (after execution of the reti instruction), the cpu restores the priority value saved in the stack before the interrupt was generated to the cpu sr. the interrupt controller also has registers (4 channels) us ed to store the micro dma st art vector. writing the start vector of the interrupt source for th e micro dma processing beforehand (s ee table 3-1), enables the corresponding interrupt to be processed by micro dma processing. the values must be set in the micro dma parameter register (e.g., dmas and dmad) prior to the micro dma processing.
page 38 2007-10-15 tmp91fw60 figure 3-3 block diagram of interrupt controller interrupt level detect iff2:0 interrupt vector generator 1 2a 3b 4c 5 6 7 0 1a 2b 3 sq r dq clr dq clr sq r y1 y2 y3 y4 y5 y6 s selector a b c reset ei 1 to 7 di if intrq2 to 0 iff2 to 0 then 1. interrupt mask f/f cpu interrupt controller interrupt request f/f nmi intwd int0 int1 int2 int3 intad inttc0 inttc1 inttc2 inttc3 priority setting register decoder priority encoder interrupt request signal to cpu reset v = 24h highest priority interrupt level select v = 20h v = 28h v = 2ch v = 30h v = cch v = d0h v = d4h v = d8h v = dch dma0v dma1v dma2v dma3v interrupt request f/f micro dma counter zero interrupt interrupt request f/f interrupt vector read interrupt vector read micro dma acknowledge reset interrupt vector read dn d0 d1 d2 d3 d4 d5 d5 d4 d3 d2 d1 d0 d6 d7 nmi if iff = 7 then 0 reset during idle1 during stop halt release dn+1 dn+2 dn+3 1 6 4 22 4 input or micro dma channel priority encoder micro dma start vector setting register micro dma channel specification micro dma request 48 6 1 7 3 3 interrupt request signal 3 intrq2 to intrq0 42 6 software start reset inttc0 int0, intrtc
page 39 2007-10-15 tmp91fw60 3.3.1 interrupt level setting registers interrupt level setting registers symbol name address 7 6 5 4 3 2 1 0 inte0ad int0 & intad enable 90h intad int0 iadc iadm2 iadm1 iadm0 i0c i0m2 i0m1 i0m0 r r/w r r/w 000 00000 inte12 int1 & int2 enable 91h int2 int1 i2c i2m2 i2m1 i2m0 i1c i1m2 i1m1 i1m0 r r/w r r/w 000 00000 inte34 int3 & int4 enable 92h int4 int3 i4c i4m2 i4m1 i4m0 i3c i3m2 i3m1 i3m0 r r/w r r/w 000 00000 inte56 int5 & int6 enable 93h int6 int5 i6c i6m2 i6m1 i6m0 i5c i5m2 i5m1 i5m0 r r/w r r/w 000 00000 inte78 int7 & int8 enable 94h int8 int7 i8c i8m2 i8m1 i8m0 i7c i7m2 i7m1 i7m0 r r/w r r/w 000 00000 inte910 int9 & int10 enable 95h int10 int9 i10c i10m2 i10m1 i10m0 i9c i9m2 i9m1 i9m0 r r/w r r/w 000 00000 inteta01 intta0 & intta1 enable 96h intta1(tmra1) intta0 (tmra0) ita1c ita1m2 ita1m1 ita1m0 ita0c ita0m2 ita0m1 ita0m0 r r/w r r/w 000 00000 ixxxc interrupt request flag ixxm2 ixxm1 ixxm0 function (write) 0 0 0 disables interrupt requests 0 0 1 sets interrupt priority level to 1 0 1 0 sets interrupt priority level to 2 0 1 1 sets interrupt priority level to 3 1 0 0 sets interrupt priority level to 4 1 0 1 sets interrupt priority level to 5 1 1 0 sets interrupt priority level to 6 1 1 1 disables interrupt requests
page 40 2007-10-15 tmp91fw60 interrupt level setting registers symbolnameaddress76543210 inteta23 intta2 & intta3 enable 97h intta3 (tmra3) intta2 (tmra2) ita3c ita3m2 ita3m1 ita3m0 ita2c ita2m2 ita2m1 ita2m0 rr/wrr/w 00000000 inteta45 intta4 & intta5 enable 98h intta5 (tmra5) intta4 (tmra4) ita5c ita5m2 ita5m1 ita5m0 ita4c ita4m2 ita4m1 ita4m0 rr/wrr/w 00000000 intetb0 interrupt enable tmrb0 99h inttb01(tmrb0) inttb00(tmrb0) itb01c itb01m2 itb01m1 itb01m0 itb00c itb00m2 itb00m1 itb00m0 rr/wrr/w 00000000 intetb1 interrupt enable tmrb1 9ah inttb11(tmrb1) inttb10(tmrb1) itb11c itb11m2 itb11m1 itb11m0 itb10c itb10m2 itb10m1 itb10m0 rr/wrr/w 00000000 intetb2 interrupt enable tmrb2 9bh inttb21(tmrb2) inttb20(tmrb2) itb21c itb21m2 itb21m1 itb21m0 itb20c itb20m2 itb20m1 itb20m0 rr/wrr/w 00000000 intetb3 interrupt enable tmrb3 9ch inttb31(tmrb3) inttb30(tmrb3) itb31c itb31m2 itb31m1 itb31m0 itb30c itb30m2 itb30m1 itb30m0 rr/wrr/w 00000000 intetb4 interrupt enable tmrb4 9dh inttb41(tmrb4) inttb40(tmrb4) itb41c itb41m2 itb41m1 itb41m0 itb40c itb40m2 itb40m1 itb40m0 rr/wrr/w 00000000 intetb01v interrupt enable tmrb0/1 (over flow) 9eh inttbof1(tmrb1 over flow) inttbof0(tmrb0 over flow) itf1c itf1m2 itf1m1 itf1m0 itf0c itf0m2 itf0m1 itf0m0 rr/wrr/w 00000000 ixxxc interrupt request flag ixxm2 ixxm1 ixxm0 function (write) 0 0 0 disables interrupt requests 0 0 1 sets interrupt priority level to 1 0 1 0 sets interrupt priority level to 2 0 1 1 sets interrupt priority level to 3 1 0 0 sets interrupt priority level to 4 1 0 1 sets interrupt priority level to 5 1 1 0 sets interrupt priority level to 6 1 1 1 disables interrupt requests
page 41 2007-10-15 tmp91fw60 interrupt level setting registers symbolnameaddress76543210 intetb23v interrupt enable tmrb2/3 (over flow) 9fh inttbof3(tmrb3 over flow) inttbof2(tmrb2 over flow) itf3c itf3m2 itf3m1 itf3m0 itf2c itf2m2 itf2m1 itf2m0 rr/wrr/w 00000000 intetb4vrtc interrupt enable tmrb4/ intrtc a0h intrtc inttbof4(tmrb4 over flow) irtcc irtcm2 irtcm1 irtcm0 itf4c itf4m2 itf4m1 itf4m0 rr/wrr/w 00000000 intes0 intrx0 & inttx0 enable a1h inttx0 intrx0 itx0c itx0m2 itx0m1 itx0m0 irx0c irx0m2 irx0m1 irx0m0 rr/wrr/w 00000000 intes1 intrx1 & inttx1 enable a2h inttx1 intrx1 itx1c itx1m2 itx1m1 itx1m0 irx1c irx1m2 irx1m1 irx1m0 rr/wrr/w 00000000 intes2 intrx2 & inttx2 enable a3h inttx2 intrx2 itx2c itx2m2 itx2m1 itx2m0 irx2c irx2m2 irx2m1 irx2m0 rr/wrr/w 00000000 intesbi01 intsbi0 & intsbi1 enable a4h intsbi1 intsbi0 isbi1c isbi1m2 isbi1m1 isbi1m0 isbi0c isbi0m2 isbi0m1 isbi0m0 rr/wrr/w 00000000 intetc01 inttc0 & inttc1 enable a5h inttc1 inttc0 itc1c itc1m2 itc1m1 itc1m0 itc0c itc0m2 itc0m1 itc0m0 rr/wrr/w 00000000 intetc23 inttc2 & inttc3 enable a6h inttc3 inttc2 itc3c itc3m2 itc3m1 itc3m0 itc2c itc2m2 itc2m1 itc2m0 rr/wrr/w 00000000 ixxxc interrupt request flag ixxm2 ixxm1 ixxm0 function (write) 0 0 0 disables interrupt requests 0 0 1 sets interrupt priority level to 1 0 1 0 sets interrupt priority level to 2 0 1 1 sets interrupt priority level to 3 1 0 0 sets interrupt priority level to 4 1 0 1 sets interrupt priority level to 5 1 1 0 sets interrupt priority level to 6 1 1 1 disables interrupt requests
page 42 2007-10-15 tmp91fw60 3.3.2 external interrupt control 3.3.3 interrupt reques t flag clear register the interrupt request flag is cleared by writing the appropriat e micro dma start vector, as given in table 3- 1, to the register intclr. for example, to clear the interrupt flag int0, perform the following register operation after execution of the di instruction. intclr 0ah: clears interrupt request flag int0. external interrupt control register (iimc) symbolnameaddress76543210 iimc interrupt input mode control 8ch rmw instruc- tions are pro- hibited. ? ? ? ? ? i0edge i0le nmiree w 00000000 always write ?0?. ???? int0 edge 0: rising 1: falling int0 mode 0: edge 1: level 1:oper- ates even on rising/ falling edge of nmi int0 setting p7fc int0 1 0 0 rising edge interruption 1 0 1 falling edge interruption 1 1 0 ?h? level int 1 1 1 ?l? level int nmi rising edge enable 0 int request generation at falling edge 1 int request generation at rising/falling edge interrupt request flag clear register (intclr) symbolnameaddress76543210 intclr interrupt clear control 88h rmw instructions are prohib- ited. ? ? clrv5 clrv4 clrv3 clrv2 clrv1 clrv0 ?? w ??000000 interrupt vector
page 43 2007-10-15 tmp91fw60 3.3.4 micro dma star t vector registers this register assigns micr o dma processing to which interrupt source. the interrupt source with a micro dma start vector that matches the vector set in this register is assigned as the micro dma start source. when the micro dma transfer counter value reaches 0, the micro dma transfer end interrupt corresponding to the channel is sent to the interrupt controller, the micro dma start vector regist er is cleared, and the micro dma start source for the channel is cleared. therefore, to continue mi cro dma processing, set the micro dma start vector register again during the processing of the micro dma transfer end interrupt. if the same vector is set in the mi cro dma start vector regi sters of more than one channel, the channel with the lowest number has a higher priority. accordingly, if the same vector is set in the micro dm a start vector registers of two channels, the interrupt generated in the channel with the lower number is ex ecuted until micro dma transfer is complete. if the micro dma start vector for this channel is not set again, the next micro dma is started for the channel with the higher number. (micro dma chaining) micro dma start vector registers (dmanv) symbolnameaddress76543210 dma0v dma0 start vector 80h ? ? dma0v5 dma0v4 dma0v3 dma0v2 dma0v1 dma0v0 ?? r/w ??000000 dma0 start vector dma1v dma1 start vector 81h ? ? dma1v5 dma1v4 dma1v3 dma1v2 dma1v1 dma1v0 ?? r/w ??000000 dma1 start vector dma2v dma2 start vector 82h ? ? dma2v5 dma2v4 dma2v3 dma2v2 dma2v1 dma2v0 ?? r/w ??000000 dma2 start vector dma3v dma3 start vector 83h ? ? dma3v5 dma3v4 dma3v3 dma3v2 dma3v1 dma3v0 ?? r/w ??000000 dma3 start vector
page 44 2007-10-15 tmp91fw60 3.3.5 micro dma burst specification specifying the micro dma burst cont inues the micro dma transfer unt il the transfer counter register reaches 0 after micro dma start. setting a bit which corresponds to the micro dma channel of the dmab registers mentioned below to ?1? specifies a burst. if other interrupts (maskable/nonmaskable is not concer ned) are generated during burst transfer, interrupt is executed after completed burst transfer. micro dma burst request registers (dmar) symbolnameaddress76543210 dmar dma software request register 89h rmw instructions are prohib- ited. ? ? ? ? dmar3 dmar2 dmar1 dmar0 ???? r/w ????0000 1: dma software request dmab dma burst register 8ah ? ? ? ? dmab3 dmab2 dmab1 dmab0 ???? r/w ????0000 1: dma burst request
page 45 2007-10-15 tmp91fw60 3.3.6 attention point the instruction execution unit and the bus interface un it of this cpu operate in dependently. therefore, immediately before an interrupt is generated, if the cpu fetches an instruction th at clears the corresponding interrupt request flag, the cpu may ex ecute the instruction that clears the interrupt request fl ag (note) between accepting and reading the inte rrupt vector. in this case, the cpu read s the default vector 0008h and reads the interrupt vector address ffff08h. to avoid the above problem, place instru ctions that clear interrupt request flags after a di instruction. and in the case of setting an interr upt enable again by ei instruction after the execution of clearing instruction, execute ei instruction after clearing and more than 1-instructions (ex. ?nop? * 1 times). if executed ei instruction without waiting nop instruction after execution of clearing instruction, interrupt will be enable before request flag is cleared. in the case of changing the value of the interrupt mask register by execution of pop sr instruc- tion, disable an interrupt by di instruction before execution of pop sr instruction. in addition, take care as the fo llowing 2 circuits ar e exceptional and demand special attention. note: the following instructions or pin input state changes are equ ivalent to instructions that clear the interrupt request flag . int0: instructions which switch to level mode after an interrupt request has been generated in edge mode. the pin input change from high to low after interrupt request has been generated in level mode. (h l) intrxn: instruction which reads the receive buffer. int0 level mode in level mode int0 is not an edge-triggered interrupt. hence, in level mode the inter- rupt request flip-flop for int0 does not function. the peripheral interrupt request passes through the s input of the flip-flop and becomes the q output. if the interrupt input mode is changed from edge mode to level mode, the interrupt request flag is cleared automatically. if the cpu enters the interrupt response sequence as a result of int0 going from 0 to 1, int0 must then be held at 1 until the interrupt response sequence has been com- pleted. if int0 is set to level mode so as to release a halt state, int0 must be held at 1 from the time int0 changes from 0 to 1 until the halt state is released. (hence, it is necessary to ensure that input noise is not inte rpreted as a 0, causing int0 to revert to 0 before the halt state has been released.) when the mode changes from level mode to edge mode, interrupt request flags which were set in level mode will not be cleared. interrupt request flags must be cleared using the following sequence. di ld (iimc), 00h ; switches interrupt input mode from level mode to edge mode. ld (intclr), 0ah ; clears interrupt request flag. nop ; wait ei instruction ei intrxn the interrupt request flip-flop can only be cl eared by reset or by reading the serial channel receive buffer. it cannot be cl eared by writing intclr register.
page 46 2007-10-15 tmp91fw60 4. port function the tmp91fw60 features 83 bit settings which relate to the various i/o ports. as well as general-purpose i/o port func tionality, the port pins also have i/o functions which relate to the built-in cpu and internal i/os. table 4-1 lists the functions of each port pin. table 4-1 lists th e functions of each port pin. table 4-2 lists i/o registers and their specifications. table 4-1 port functions (r: pu = wit h programmable pull-up resistor) (1/2) port names pin names number of pins direction r direction setting unit pin names for built-in functions port0 p00 to p07 8 i/o ? bit ad0 to ad7 port1 p10 to p17 8 i/o ? bit ad8 to ad15/a8 to a15 port2 p20 p27 8 i/o ? bit a16 to a23/a0 to a7 port3 p30 1 i/o ? bit tb3in0, int3, sda0 p31 1 i/o ? bit tb3in1, int4, scl0 p32 1 i/o ? bit wait , tb3out0 p33 1 i/o ? bit tb3out1 port4 p40 1 i/o pu bit cs0 , scout p41 1 i/o pu bit cs1 , txd2 p42 1 i/o pu bit cs2 rxd2 p43 1 i/o pu bit cs3 , sclk2, cts2 p44 1 i/o pu bit ale port5 p50 1 i/o ? bit an0 p51 1 i/o ? bit an1 p52 1 i/o ? bit an2 p53 1 i/o ? bit an3 p54 1 i/o ? bit an4 p55 1 i/o ? bit an5 p56 1 i/o ? bit an6 p57 1 i/o ? bit an7 port6 p60 1 i/o ? bit an8 p61 1 i/o ? bit an9 p62 1 i/o ? bit an10 p63 1 i/o ? bit an11 p64 1 i/o ? bit an12 p65 1 i/o ? bit an13 p66 1 i/o ? bit an14 p67 1 i/o ? bit an15
page 47 2007-10-15 tmp91fw60 port7 p70 1 i/o ? bit ta0in p71 1 i/o ? bit ta1out p72 1 i/o ? bit ta3out p73 1 i/o ? bit ta4in p74 1 i/o ? bit ta5out p75 1 i/o ? bit int0 port8 p80 1 i/o ? bit tb0in0, int5 p81 1 i/o ? bit tb0in1, int6 p82 1 i/o ? bit tb0out0 p83 1 i/o ? bit tb0out1 p84 1 i/o ? bit tb1in0, int7 p85 1 i/o ? bit tb1in1, int8 p86 1 i/o ? bit tb1out0 p87 1 i/o ? bit tb1out1 port9 p90 1 i/o ? bit txd0 p91 1 i/o ? bit rxd0 p92 1 i/o ? bit sclk0, cts0 p93 1 i/o ? bit txd1 p94 1 i/o ? bit rxd1 p95 1 i/o ? bit sclk1, cts1 p96 1 i/o ? bit xt1 p97 1 i/o ? bit xt2 porta pa0 1 i/o ? bit tb2in0, int1 pa1 1 i/o ? bit tb2in1, int2 pa2 1 i/o ? bit tb2out0 pa3 1 i/o ? bit tb2out1 portb pb0 1 i/o ? bit tb4in0, int9, sda1 pb1 1 i/o ? bit tb4in1, int10, scl1 pb2 1 i/o ? bit tb4out0 pb3 1 i/o ? bit tb4out1 portz pz0 1 output ? bit rd pz1 1 output ? bit wr pz2 1 i/o pu bit hwr pz3 1 i/o pu bit r/w table 4-1 port functions (r: pu = wit h programmable pull-up resistor) (2/2) port names pin names number of pins direction r direction setting unit pin names for built-in functions
page 48 2007-10-15 tmp91fw60 table 4-2 i/o port setting list(1/4) ports pin names specifications i/o register setting values pn pncr pnfc pnfc2 ode port0 p00 to p07 input port 0 none none none output port 1 ad0 to ad7 bus #1 port1 p10 to p17 input port 00 none none output port 10 ad8 to ad15 bus 01 a8 to a15 output 11 port2 p20 to p27 input port 00 none none output port 10 a0 to a7 output 01 a16 to a23 output 11 port3 p30 to p31 input port 000 ? output port (cmos output) 1000 output port (open drain output) 1001 p32 to p33 input port 00 none none output port 10 p30 tb3in0 input, int3 input 010 ? sda0 input/output (cmos output) 1010 sda0 input/output (open drain output) #2 1011 p31 tb3in1 input, int4 input 010 ? scl0 input/output (cmos output) 1010 scl0 input/output (open drain output) #2 1011 p32 wait output 01 none none tb3out0 output 11 p33 tb3out1 output 11
page 49 2007-10-15 tmp91fw60 port4 p40, p43 input port (without pull up) 0000 none input port (with pull up) 1000 output port 100 p42, p44 input port (without pull up) 000 none none input port (with pull up) 100 output port 10 p41 input port (without pull up) 0000 ? input port (with pull up) 1000 ? output port (cmos output) 1000 output port (open drain output) 1001 p40 cs0 output 110 none scout output 101 p41 cs1 output (cmos output) 1100 cs1 output (open drain output) 1101 txd2 output (cmos output) 1010 txd2 output (open drain output) #2 1011 p42 cs2 output 11 none none rxd2 input 00 p43 cs3 output 110 none sclk2 input 000 sclk2 output 101 cts2 input 000 p44 ale output 1 1 none none port5 p50 to p57 input port 01 none none output port 10 an0 to an7 input #3 00 port6 p60 to p67 input port 01 none none output port 10 an8 to an15 input #3 00 port7 p70 to p75 input port 00 none none output port 10 p70 ta0in input 0 none p71 ta1out output 11 p72 ta3out output 11 p73 ta4in input 0 none p74 ta5out output 11 p75 int0 input 01 table 4-2 i/o port setting list(2/4) ports pin names specifications i/o register setting values pn pncr pnfc pnfc2 ode
page 50 2007-10-15 tmp91fw60 port8 p80 to p87 input port 00 none none output port 10 p80 tb0in0, int5 input 01 p81 tb0in1, int6 input 01 p82 tb0out0 output 11 p83 tb0out1 output 11 p84 tb1in0, int7 input 01 p85 tb1in1, int8 input 01 p86 tb1out0 output 11 p87 tb1out1 output 11 port9 p91 to p92, p94 to p95 input port 00 none none output port 10 p90, p93 input port 00 ? output port (cmos output) 10 0 output port (open drain output) 10 1 p90 txd0 output (cmos output) 11 0 txd0 output (open drain output) #2 11 1 p91 rxd0 input 0 none none p92 sclk0 input 00 none sclk0 output 11 cts0 input 00 p93 txd1 output (cmos output) 11 0 txd1 output (open drain output) #2 11 1 p94 rxd1 input 0 none none p95 sclk1 input 00 none sclk1 output 11 cts1 input 00 p96 to p97 input port 01 none output port 11 xt1 to xt2 #4 00 porta pa0 to pa3 input port 00 none none output port 10 pa0 tb2in0 input, int1 input 01 pa1 tb2in1 input, int2 input 01 pa2 tb2out0 11 pa3 tb2out1 11 table 4-2 i/o port setting list(3/4) ports pin names specifications i/o register setting values pn pncr pnfc pnfc2 ode
page 51 2007-10-15 tmp91fw60 note: :don?t care portb pb0 to pb1 input port 000 ? output port (cmos output) 1000 output port (open drain output) 1001 pb2 to pb3 input port 00 none none output port 10 pb0 tb4in0 input, int9 input 010 ? sda1 input/output (cmos output) 1010 sda1 input/output (open drain output) #2 1011 pb1 tb4in1 input, int10 input 010 ? scl1 input/output (cmos output) 1010 scl1 input/output (open drain output) #2 1011 pb2 tb4out0 output 11 none none pb3 tb4out1 output 11 portz pz0 output port none 0 none none rd output only when accessing an external 11 always rd output 0 1 pz1 output port none 0 wr output only when accessing an external 1 pz2 to pz3 input port (without pull up) 000 input port (with pull up) 100 output port 10 pz2 hwr output 11 pz3 r/w output 01 #1 there is not port setting for changing ad0 to ad7. w hen accessing external area, it changes automatically. #2 if using p30/p31/p41/p90/p93/pb0/pb1 as open-drain output in sda0/scl0/txd2/txd0/txd1/sda1/scl1 output, please set ode. #3 if using p50 to p57,p60 to p67 as an analog input, please set adccr1. #4 if using p96 to p97 as xt1-xt2, please set syscr0. table 4-2 i/o port setting list(4/4) ports pin names specifications i/o register setting values pn pncr pnfc pnfc2 ode
page 52 2007-10-15 tmp91fw60 4.1 port 0 (p00 to p07) port 0 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p0cr. reset operation initializes all bits of the control register p0cr to ?0? and sets port 0 to input port. in addition to functioning as a general-purpose i/o port, port 0 can also function as address data bus (ad0 to ad7). when accessing external area, port 0 functions as address data bus (ad0 to ad7) automatically, and p0cr is cleared to ?0?. figure 4-1 port 0 note: is bit x of each register p0cr. port 0 register 76543210 p0 (0000h) bit symbol p07 p06 p05 p04 p03 p02 p01 p00 read/write r/w after reset data from external port (output latch register is undefined.) port 0 control register (read-modify-write instructions are prohibited.) p0cr (0002h) 76543210 bit symbol p07c p06c p05c p04c p03c p02c p01c p00c read/write w after reset00000000 function 0: input 1: output (when acce ss to external, become ad7 to ad0 an d this register is cleared to ?0?.) access p0xc p07 function p06 function p05 function p04 function p03 function p02 function p01 function p00 function internal 0 input port input port input port input port input port input port input port input port 1 output port output port output port output port output port output port output port output port external cleared to "0" ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 1wvrwv ncvej direction control (on bit basis) 5gngevqt s a b reset p0cr write internal data bus p0 write p0 read output buffer port 0 p00 to p07 (ad0 to ad7)
page 53 2007-10-15 tmp91fw60 4.2 port 1 (p10 to p17) port 1 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p1cr and function register p1fc. reset operation in itializes all bits of output latch p1, the control register p1cr and function register p1fc to ?0? and sets port 1 to input port. in addition to functioning as a general-purpose i/o port, port 1 can also function as address data bus (ad8 to ad15) and address bus (a8 to a15). figure 4-2 port 1 1wvrwvncvej function control (on bit basis) 1wvrwvdwhhgt direction control (on bit basis) p1 read 2qtv p10 to p17 (ad8 to ad15/a8 to a1 5 5gngevqt s a b internal data bus reset p1cr write p1fc write p1 write
page 54 2007-10-15 tmp91fw60 note: / is bit x of each register p1fc/p1cr. port 1 register p1 (0001h) 76543210 bit symbol p17 p16 p15 p14 p13 p12 p11 p10 read/write r/w after reset data from external port (output latch register is cleared to ?0?.) port 1 control register ( read-modify-write instructions are prohibited.) p1cr (0004h) 76543210 bit symbol p17c p16c p15c p14c p13c p12c p11c p10c read/write w after reset00000000 function <> port 1 function register ( read-modify-write instructions are prohibited.) p1fc (0005h) 76543210 bit symbol p17f p16f p15f p14f p13f p12f p11f p10f read/write w after reset00000000 function p1fc/p1cr = 00: input, 01: output, 10: ad15 to ad8, 11: a15 to a8 p1xf p1xc p17 function p16 function p15 function p14 function p13 function p12 function p11 function p10 function 0 0 input port input port input port input port input port input port input port input port 0 1 output port output port output port output port output port output port output port output port 1 0 ad15 ad14 ad13 ad12 ad11 ad10 ad9 ad8 1 1 a15 a14 a13 a12 a11 a10 a9 a8
page 55 2007-10-15 tmp91fw60 4.3 port 2 (p20 to p27) port 2 is an 8-bit general-purpose i/o port. each bit can be set individually for input or output using the control register p2cr and function register p2fc. reset operation initia lizes all bits of output la tch p2 to ?1?, and the con- trol register p2cr and function register p2fc to ?0?, and sets port 2 to input port. in addition to functioning as a genera l-purpose i/o port, port 2 can also f unction as address bus (a0 to a5) and address bus (a16 to a23). figure 4-3 port 2 1wvrwvncvej function control (on bit basis) 1wvrwvdwhhgt p2fc ytkvg direction control (on bit basis) p2cr ytkvg p2 ytkvg 4gugv s s a b a a16 to a23 a0 to a7 b p2 tgcf 2qtv p20~p27 (a0~a7/a16~a23)  5gngevqt s a b selector selector internal data bus
page 56 2007-10-15 tmp91fw60 note: / is bit x of each register p2fc/p2cr. when setting to address bus a23 to a16, set p2fc after setting p2cr. if p2cr is set after setting p2fc, a7 to a0 are outputted between setting p2fc and setting p2cr when p2cr is ?0?. port 2 register 76543210 p2 (0006h) bit symbol p27 p26 p25 p24 p23 p22 p21 p20 read/write r/w after reset data from external port (output latch register is set to ?1?.) port 2 control register ( read-modify-write instructions are prohibited.) p2cr (0008h) 76543210 bit symbol p27c p26c p25c p24c p23c p22c p21c p20c read/write w after reset00000000 function <> port 2 function register ( read-modify-write instructions are prohibited.) p2fc (0009h) 76543210 bit symbol p27f p26f p25f p24f p23f p22f p21f p20f read/write w after reset00000000 function p2fc/p2cr = 00: input, 01: output, 10: a7 to a0, 11: a23 to a16 p2xf p2xc p27 function p26 function p25 function p24 function p23 function p22 function p21 function p20 function 0 0 input port input port input port input port input port input port input port input port 0 1 output port output port output port output port output port output port output port output port 1 0 a7 a6 a5 a4 a3 a2 a1 a0 1 1 a23 a22 a21 a20 a19 a18 a17 a16
page 57 2007-10-15 tmp91fw60 4.4 port3 (p30 to p33) port 3 is an 4-bit general-purpose i/o port. reset operation initializes to input port. all bits of output latch register p3 are set to ?1?. there are the following functions in addition to an i/o port. this function enable each function by writing ?1? to applicable bit of port 3 function register p3fc. ? the input function of wait control (wait ) ? the input function of external interrupt (int3, int4) ? the input function of 16-bit timer 3 ( tb3in0, tb3in1 ) ? the output function of 16-bit timer 3 (tb3out0, tb3out1) ? the i/o function of serial bus interface 0 (sda0, scl0) reset operation initializes, p3cr,p3fc and p3fc 2 to ?0?, all bits are set to input port. and port 30 and 31 have a programmable open-drain function which can be controlled by the ode register. figure 4-4 port 30 and 31 sda0 qwvrwv scl0 qwvrwv a b s a b s p30(tb3in0,int3,sda0) p31(tb3in1,int4,scl0) p3 tgcf direction control (on bit basis) p3cr write s 1wvrwvncve j 4gugv tb3in0,int3 tb3in1,int4 sda0 kprwv scl0 kprwv 2(% p3fc write internal data bus function control 2 (on bit basis) p3fc2 write p3 write function control (on bit basis) 5gngevqt 5gngevqt open-drain possible: ode
page 58 2007-10-15 tmp91fw60 figure 4-5 port 32 and 33 tb3out0 qwvrw v  5gngevqt a b s 5gngevqt a b s p32( wait ,tb3out0) p3 tgcf direction control (on bit basis) p3cr ytkvg function control (on bit basis) p3fc ytkvg s 1 wvrwvncvej p3 ytkvg 4gugv kpvgtpcn wait tb3out1 qwvrwv   a b s a b s p33(tb3out1) p3cr ytkvg ?(? ? ( f6; ) p3fc write s 1wvrwvncve j p3 ytkvg 4gugv p3 tgcf internal data bus internal data bus direction control (on bit basis) 5gngevqt 5gngevqt
page 59 2007-10-15 tmp91fw60 note 1: // is bit x of each register p3fc2/p3fc/p3cr. note 2: wen p32/wait pin is used as a wait pin, set p3cr to "0" and chip sele ct/wait control register to "010". port 3 register 76543210 p3 (000ch) bit symbol ???? p33 p32 p31 p30 read/write ???? r/w after reset ???? data from external port (output latch register is set to ?1?.) function - output mode port 3 control register ( read-modify-write instructions are prohibited. ) p3cr (000eh) 76543210 bit symbol ???? p33c p32c p31c p30c read/write ???? w after reset ???? 0000 function - 0:input 1:output port 3 function register ( read-modify-write instructions are prohibited. ) p3fc (000fh) 76543210 bit symbol ???? p33f p32f p31f p30f read/write ???? w after reset ???? 0000 port 3 function register 2 ( read-modify-write instructions are prohibited. ) p3fc2 (000dh) 76543210 bit symbol ?????? p31f2 p30f2 read/write ?????? w after reset ?????? 00 p3xf2 p3xf p3xc p33 function p32 function p31 function p30 function 0 0 0 input port input port input port input port 0 0 1 output port output port output port output port 0 1 0 reserved wait tb3in1/int4 tb3in0/int3 0 1 1 tb3out1 tb3out0 reserved reserved 1 0 0 reserved reserved reserved reserved 1 0 1 reserved reserved scl0 sda0 1 1 0 reserved reserved reserved reserved 1 1 1 reserved reserved reserved reserved
page 60 2007-10-15 tmp91fw60 4.5 port 4 (p40 to p44) port 4 is an 5-bit general-purpose i/o port. reset operati on initializes to input port, and connects a pull-up resistor. all bits of output latch register p4 are set to ?1?. there are the following functions in addition to an i/o port. this function enable each function by writing ?1? to applicable bit of port 4 function register p4fc. ? the output function of a chip select signal (cs0 to cs3 ) ? the i/o function of the serial channel 2 ( rxd2, txd2, sclk2/cts2 ) ? the output function of an addr ess latch enable signal (ale) ? the output function of a system clock signal (scout) reset operation initializes, p4cr,p4fc and p4fc 2 to ?0?, all bits are set to input port. and port 41 have a programmable open-drain function which can be controlled by the ode register. figure 4-6 port 40  function control (on bit basis) 5 1wvrwv ncvej   direction control (on bit basis)    function control 2 (on bit basis) 5 # $ 5 5%176  % & tgugtxgf %5 2
%55%176 p-ch (programmable pull up) internal data bus selector p4 read p4 write p4fc2 write p4fc write p4cr write reset output buffer
page 61 2007-10-15 tmp91fw60 figure 4-7 port 41 input (internal signal) =0 =1 output buffer pull-up output buffer pull-up =0,cs1 =0, txd2=0 l level output off l level output off =1, cs1 =1, txd2=1 h level output on hi-z on  5      2
%5 6:&  1wvrwvdwhhgt     5 # $ 5 %5  tgugtxgf % & 6:&  selector p-ch (programmable pull up) p4 read p4 write 1wvrwv ncvej p4fc2 write p4fc write p4cr write reset internal data bus function control (on bit basis) direction control (on bit basis) function control 2 (on bit basis) open-drain possible: ode
page 62 2007-10-15 tmp91fw60 figure 4-8 port 42   5       2
%5 4:&     5 # $ %5   4:&  function control (on bit basis) direction control (on bit basis) internal data bus p4fc write p4cr write reset 1wvrwv ncvej p4 write p4 read p-ch (programmable pull up) selector output buffer
page 63 2007-10-15 tmp91fw60 figure 4-9 port 43  5   2
%5 5%.- %65   5%.- %65    5 # tgugtxgf $ % & %5  5%.-  5 function control (on bit basis) 1wvrwv ncvej direction control (on bit basis) function control 2 (on bit basis) internal data bus p4 write p4fc2 write p4fc write p4cr write reset p-ch (programmable pull up) selector p4 read output buffer
page 64 2007-10-15 tmp91fw60 figure 4-10 port 44   5  2
#.'   5 # $ #.'  function control (on bit basis) direction control (on bit basis) internal data bus p4fc write p4cr write reset 1wvrwv ncvej p4 write p4 read p-ch (programmable pull up) selector output buffer
page 65 2007-10-15 tmp91fw60 note 1: // is bit x of each register p4fc2/p4fc/p4cr. note 2: when port 4 is used as input mode, p4 register controls internal pull-up resistor. read-modify-write instruction is proh ib- ited in input mode or i/o mode. setting the internal pull- up resistor may be depended on the states of the input pin. note 3: when outputting chip select signal (cs0 to cs3 ), set bit of control register (p4cr) to ?1? after setting bit of function regis- ter (p4fc) to ?1?. if p4fc is set after setting p4cr, va lue of p4 register is outputted between setting p4cr and setting p4fc. note 4: when setting txd2 pin to open-drain output, write ?1? to bit2 of ode register. p42/rxd2 pin does not have a register which changes port/function. for example, when it is also us ed as an input port, the input signal is inputted to sio as serial receiving data. port 4 register 76543210 p4 (0010h) bit symbol ??? p44 p43 p42 p41 p40 read/write ??? r/w after reset ??? data from external port (output latch register is set to ?1?.) function 0 (output latch register): pull-up resistor off 1 (output latch register): pull-up resistor on port 4 control register (read-modify-write instructions are prohibited.) p4cr (0012h) 76543210 bit symbol ??? p44c p43c p42c p41c p40c read/write ??? w after reset ??? 00000 function 0: input 1: output port 4 function register ( read-modify-write instructions are prohibited.) p4fc (0013h) 76543210 bit symbol ??? p44f p43f p42f p41f p40f read/write ??? w after reset ??? 00000 port 4 function register 2 ( read-modify-write instructions are prohibited.) p4fc2 (0011h) 76543210 bit symbol ???? p43f2 ? p41f2 p40f2 read/write ???? w ? w after reset ???? 0 ? 00 p4xf2 p4xf p4xc p44 function p43 function p42 function p41 function p40 function 0 0 0 input port input port (sclk2/cts2) input port (rxd2) input port input port 0 0 1 output port output port output port output port output port 0 1 0 reserved reserved reserved reserved reserved 0 1 1 ale output cs3 cs2 cs1 cs0 1 0 0 input port reserved input port (rxd2) reserved reserved 1 0 1 output port sclk2 output port txd2 scout 1 1 0 reserved reserved reserved reserved reserved 1 1 1 ale output reserved cs2 reserved reserved
page 66 2007-10-15 tmp91fw60 4.6 port 5 (p50 to p57) port 5 is an 8-bit general-purpose i/o port. by the reset action, it becomes hi-z and becomes analog input permis- sion.all bits of output latch register p5 are set to ?1?. there are the following functions in addition to an i/o port. ? the input function of the analog/digital converter (an0 to an7) reset operation initializes, p5cr,p5fc to ?0?, all bits are set to input port. figure 4-11 port 5  5gngevqt a b s port 5 p50 to p57 (an0 to an7) s #& eqpxgtukqp tguwnv tgikuvgt ad eqpxgtvqt ejcppgn ugngevqt function control (on bit basis) direction control (on bit basis) internal data bus p5fc write p5cr write reset 1wvrwv ncvej p5 write p5 read ad read
page 67 2007-10-15 tmp91fw60 note 1: / is bit x of each register p5fc/p5cr. note 2: the input channel selection of ad converte r are set by ad converter mode register adccr1. port 5 register 76543210 p5 (0014h) bit symbol p57 p56 p55 p54 p53 p52 p51 p50 read/write r/w after reset data from external port (output latch register is set to ?1?.) port 5 control register ( read-modify-write instructions are prohibited. ) 76543210 p5cr (0016h) bit symbol p57c p56c p55c p54c p53c p52c p51c p50c read/write w after reset00000000 function 0: input 1: output port 5 function register ( read-modify-write instructions are prohibited. ) 76543210 p5fc (0017h) bit symbol p57f p56f p55f p54f p53f p52f p51f p50f read/write w after reset00000000 function p57 input 0:disable 1:enable p56 input 0:disable 1:enable p55 input 0:disable 1:enable p54 input 0:disable 1:enable p53 input 0:disable 1:enable p52 input 0:disable 1:enable p51 input 0:disable 1:enable p50 input 0:disable 1:enable p5xf p5xc p57 function p56 function p55 function p54 function p53 function p52 function p51 function p50 function 0 0 input disable input disable input di sable input disable input disable inp ut disable input disable input disable 0 1 output port output port output port output port output port output port output port output port 1 0 input enable input enable input enable input enable input enable input enable input enable input enable 1 1 output port output port output port output port output port output port output port output port
page 68 2007-10-15 tmp91fw60 4.7 port 6 (p60 to p67) port 6 is an 8-bit general-purpose i/o port. by the reset action, it becomes hi-z and becomes analog input permis- sion.all bits of output latch register p6 are set to ?1?. there are the following functions in addition to an i/o port. ? the input function of the analog/digital converter (an8 to an15) reset operation initializes, p6cr,p6fc to ?0?, all bits are set to input port. figure 4-12 port 6   a b s s 5gngevqt port 6 p60 to p67 (an8 to an15) #& eqpxgtukqp tguwnv tgikuvgt ad eqpxgtvqt ejcppgn ugngevqt function control (on bit basis) direction control (on bit basis) internal data bus p6fc write p6cr write reset 1wvrwv ncvej p6 write p6 read ad read
page 69 2007-10-15 tmp91fw60 note 1: / is bit x of each register p6fc/p6cr. note 2: the input channel selection of ad converte r are set by ad converter mode register adccr1. port 6 register 76543210 p6 (0018h) bit symbol p67 p66 p65 p64 p63 p62 p61 p60 read/write r/w after reset data from external port (output latch register is set to ?1?.) port 6 control register ( read-modify-write instructions are prohibited. ) 76543210 p6cr (001ah) bit symbol p67c p66c p65c p64c p63c p62c p61c p60c read/write w after reset00000000 function 0: input 1: output port 6 function register ( read-modify-write instructions are prohibited. ) 76543210 p6fc (001bh) bit symbol p67f p66f p65f p64f p63f p62f p61f p60f read/write w after reset00000000 function p67 input 0:disable 1:enable p66 input 0:disable 1:enable p65 input 0:disable 1:enable p64 input 0:disable 1:enable p63 input 0:disable 1:enable p62 input 0:disable 1:enable p61 input 0:disable 1:enable p60 input 0:disable 1:enable p6xf p6xc p67 function p66 function p65 function p64 function p63 function p62 function p61 function p60 function 0 0 input disable input disable input di sable input disable input disable inp ut disable input disable input disable 0 1 output port output port output port output port output port output port output port output port 1 0 input enable input enable input enable input enable input enable input enable input enable input enable 1 1 output port output port output port output port output port output port output port output port
page 70 2007-10-15 tmp91fw60 4.8 port 7 (p70 to p75) port 7 is an 6-bit general-purpose i/o port. reset operation initializes to input port. all bits of output latch register p7 are set to ?1?. there are the following functions in addition to an i/o port. this function enable each function by writing ?1? to applicable bit of port 7 function register p7fc. ? the i/o function of 8-bit timer 01 (ta0in,ta1out) ? the output function of 8-bit timer 23 (ta3out) ? the i/o function of 8-bit timer 45 (ta4in,ta5out) ? the input function of external interrupt (int0) reset operation initializes, p7cr and p7fc to ?0?, all bits are set to input port. figure 4-13 port 70 to 74 s 1wvrwvncvej direction control (on bit basis) p7cr ytkvg  p7 ytkvg 4gugv p7 tgcf p70 (ta0in) p73 (ta4in) ta0in ta4in s b 5gngevqt a s 1wvrwvncvej direction control (on bit basis) p7cr ytkvg function control (on bit basis) p7fc ytkvg p7 ytkvg 4gugv p7 4gcf 6kogt f/f out ta1out: tmra1 ta3out: tmra3 ta5out: tmra5 p71 (ta1out) p72 (ta3out) p74 (ta5out) a s 5gngevqt b b 5gngevqt s internal data bus
page 71 2007-10-15 tmp91fw60 figure 4-14 port 75 a b p75(int0) s output latch +06 .gxgngfig & 4kukpihcnnkpifgvgev iimc s p7cr ytkvg p7fc ytkvg p7 ytkvg 4gugv p7 4gcf internal data bus direction control (on bit basis) function control (on bit basis) selector
page 72 2007-10-15 tmp91fw60 note 1: / is bit x of each register p7fc/p7cr. note 2: p70/ta0in, p73/ta4in pin dose not have a register changing port/function. for example, when it is used as an input port, the input signal is inputted to 8bit timer. port 7 register 76543210 p7 (001ch) bit symbol ?? p75 p74 p73 p72 p71 p70 read/write ?? r/w after reset ?? data from external port (output latch register is set to ?1?.) port 7 control register ( read-modify-write instructions are prohibited. ) 76543210 p7cr (001eh) bit symbol ?? p75c p74c p73c p72c p71c p70c read/write ?? w after reset ?? 000000 function 0: input 1: output port 7 function register ( read-modify-write instructions are prohibited. ) 76543210 p7fc (001fh) bit symbol ?? p75f p74f ? p72f p71f ? read/write ?? w ? w ? after reset ?? 00 ? 00 ? function 0: port 1: int0 0: port 1: ta5out 0: port 1: ta3out 0: port 1: ta1out p75 int0 setting int0 1 0 0 rising edge detect int 1 0 1 falling edge detect int 1 1 0 h level int 1 1 1 l level int p7xf p7xc p75 function p74 function p73 function p72 function p71 function p70 function 0 0 input port input port input port (ta4in) input port input port input port (ta0in) 0 1 output port output port output port output port output port output port 1 0 int0 reserved reserved reserved reserved reserved 1 1 reserved ta5out reserved ta3out ta1out reserved
page 73 2007-10-15 tmp91fw60 4.9 port 8 (p80 to p87) port 8 is an 8-bit general-purpose i/o port. reset operation initializes to input port. all bits of output latch register p8 are set to ?1?. there are the following functions in addition to an i/o port. this function enable each function by writing ?1? to applicable bit of port 8 function register p8fc. ? the i/o function of 16-bit timer 0 (tb0in0,tb0in1,tb0out0,tb0out1) ? the i/o function of 16-bit timer 1 (tb1in0,tb1in1,tb1out0,tb1out1) ? the input function of external interrupt (int5 to int8) reset operation initializes, p8cr and p8fc to ?0?, all bits are set to input port. figure 4-15 port 8 s 1wvrwvncvej direction control (on bit basis) p8cr ytkvg p8 ytkvg 4gugv function control (on bit basis) p8fc ytkvg p8 tgcf p80 (tb0in0/int5) p81 (tb0in1/int6) p84 (tb1in0/int7) p85 (tb1in1/int8) tb0in0, int5 tb0in1, int6 tb1in0, int7 tb1in1, int8 s b 5gngevqt a s 1wvrwvncvej direction control (on bit basis) p8cr ytkvg function control (on bit basis) p8fc ytkvg p8 ytkvg 4gugv p8 tgcf 6kogt f/f out tb0out0: tmrb0 tb0out1: tmrb0 tb1out0: tmrb1 tb1out1: tmrb1 p82 (tb0out0) p83 (tb0out1) p86 (tb1out0) p87 (tb1out1) a s 5gngevqt b b 5gngevqt s internal data bus
page 74 2007-10-15 tmp91fw60 note: / is bit x of each register p8fc/p8cr. port 8 register 76543210 p8 (0020h) bit symbol p87 p86 p85 p84 p83 p82 p81 p80 read/write r/w after reset data from external port (out put latch register is set to ?1?.) port 8 control register (read-modify-write instructions are prohibited.) 76543210 p8cr (0022h) bit symbol p87c p86c p85c p84c p83c p82c p81c p80c read/write w after reset00000000 function 0: input 1: output port 8 function register (read-modify-write instructions are prohibited.) 76543210 p8fc (0023h) bit symbol p87f p86f p85f p84f p83f p82f p81f p80f read/write w after reset00000000 function 0: port 1: tb1out1 0: port 1: tb1out0 0: port 1: tb1in1, int8 0: port 1: tb1in0, int7 0: port 1: tb0out1 0: port 1: tb0out0 0: port 1: tb0in1, int6 0: port 1: tb0in0, int5 p8xf p8xc p87 function p86 function p85 function p84 function p83 function p82 function p81 function p80 function 0 0 input port input port input port input port input port input port input port input port 0 1 output port output port output port output port output port output port output port output port 1 0 reserved reserved tb1in1/ int8 tb1in0/ int7 reserved reserved tb0in1/ int6 tb0in0/ int5 1 1 tb1out1 tb1out0 reserved reserved tb0out1 tb0out0 reserved reserved
page 75 2007-10-15 tmp91fw60 4.10 port 9 (p90 to p97) ? port 90 to 95 port 90 to 95 are a 6-bit general-purpose i/o port. re set operation initializes to input port. all bits of output latch register are set to ?1?. in addition to functioning as a i/o port, port 90 to 95 can also function as i/o of sio0, sio1. this func- tion enable each function by writing ?1? to applicable bit of port 9 function register p9fc. reset operation initializes p9cr and p9fc to ?0?, all bits are set to input port. ? port 96 to 97 port 96 to 97 are a 2-bit general-pur pose i/o port. in case of output port, this is open drain output. reset operation initializes output latch regist er and control register to ?1?, and it is set to ?high-z? (high imped- ance). in addition to functioning as a i/o port, port 96 to 97 can also function as lo w-frequency oscillator con- nection pin (xt1 and xt2) during using low speed cl ock function. therefore, dual clock function can use by setting of system clock control registers syscr0 and syscr1. 4.10.1 port 90 and 93 (txd0 and txd1) in addition to functioning as a i/o port, port 90 and 93 can also function as txd output pin of serial channel. and port 90 and 93 have a programmable open-drain function which can be controlled by the ode register. figure 4-16 port 90 and 93 s 1wvrwvncvej direction control (on bit basis) p9cr ytkvg function control (on bit basis) p9fc ytkvg p9 ytkvg txd0, txd1 4gugv p9 tgcf p90 (txd0) p93 (txd1) a s 5gngevqt b s b 5gngevqt a 1wvrwvdwhhgt open-drain possible: ode internal data bus
page 76 2007-10-15 tmp91fw60 4.10.2 port91(rxd0), 94 (rxd1) in addition to functioning as a i/o port, port 91 and 94 can also function as rxd input pin of serial channel. figure 4-17 port 91 and 94 s 1wvrwvncvej direction control (on bit basis) p9cr ytkvg p9 ytkvg rxd0, rxd1 4gugv p9 tgcf p91 (rxd0) p94 (rxd1) s b 5gngevqt a internal data bus
page 77 2007-10-15 tmp91fw60 4.10.3 port 92( cts0 /sclk0), 95 ( cts1 /sclk1) in addition to functioning as a i/o port, port 92 and 95 can also function as cts input pin or sclk i/o pin of serial channel. figure 4-18 port 92 and 95 s 1wvrwvncvej direction control (on bit basis) function control (on bit basis) sclk0, sclk1 qwvrwv cts0, cts1 sclk0, sclk1 kprwv p92 (sclk0/cts0) p95 (sclk1/cts1) a s 5gngevqt b s b 5gngevqt a p9cr ytkvg p9fc ytkvg p9 ytkvg 4gugv p9 tgcf internal data bus
page 78 2007-10-15 tmp91fw60 4.10.4 port 96 (xt1), 97 (xt2) in addition to functioning as a i/o port, port 96 and 97 can also function as low frequency oscillator connec- tion pins. figure 4-19 port 96 and 97  5gngevqt  5 $ # ;    direction control (on bit basis)   4gugv  2%4 ytkvg 2 ytkvg  5 1wvrwvncvej    5gngevqt  2 tgcf    direction control (on bit basis)   2%4 ytkvg 2 ytkvg  5 1wvrwvncvej   2tgcf 1wvrwvdwhhgt 2
:6  2
:6  .qyhtgswgpe[enqem
hu 
1pcv  5 $ # ;  function control (on bit basis)   2 (% ytkvg  function control (on bit basis)   2 (% ytkvg  1wvrwvdwhhgt internal data bus .qyhtgswgpe[queknncvkqpgpcdng
page 79 2007-10-15 tmp91fw60 note 1: / is bit x of each register p9fc/p9cr. note 2: when setting txd pin to open-drain output, write ?1? to bit3 of ode register (for txd0 pin), or bit4 (for txd1 pin). p91 / rxd0 and p94/rxd1 pin does not have a register which changes port/function. for example, when it is also used as an input port, the input signal is inputted to sio as serial receiving data. note 3: low frequency oscillation circuit to connect a low frequency resonator to port 96 and 97, it is necessary to set a following procedure to reduce the con- sumption power supply. (case of resonator connection) p9cr = ?11?, p9 = ?00? (case of external clock input) p9cr = ?11?, p9 = ?10? port 9 register 76543210 p9 (0024h) bit symbol p97 p96 p95 p94 p93 p92 p91 p90 read/write r/w after reset data from external port (output latch register is set to ?1?.) port 9 control register ( read-modify-write instructions are prohibited.) 76543210 p9cr (0026h) bit symbol p97c p96c p95c p94c p93c p92c p91c p90c read/write w after reset11000000 function 0: input 1: output port 9 function register ( read-modify-write instructions are prohibited.) 76543210 p9fc (0027h) bit symbol p97f p96f p95f ? p93f p92f ? p90f read/write w ? w ? w after reset000?00?0 function port 0: disable 1: enable port 0: disable 1: enable 0: port 1: sclk1 output 0: port 1: txd1 out- put 0: port 1: sclk0 output 0: port 1: txd0 out- put p9xf p9xc p97 function p96 function p95 function p94 function p93 function p92 function p91 function p90 function 0 0 xt2 xt1 input port input port input port input port input port input port 0 1 reserved reserved output port output port output port output port output port output port 1 0 input port input port reserved reserved reserved reserved reserved reserved 1 1 output port output port sclk1 reserved txd1 sclk0 reserved txd0
page 80 2007-10-15 tmp91fw60 4.11 port a (pa0 to pa3) port a is an 4-bit general-purpose i/o port. reset operation initializes to input port. all bits of output latch register pa are set to ?1?. there are the following functions in addition to an i/o port. this function enable each function by writing ?1? to applicable bit of port a function register pafc. ? the i/o function of 16-bit timer 2 (tb2in0,tb2in1,tb2out0,tb2out1) ? the input function of external interrupt (int1, int2) reset operation initializes, pacr and pafc to ?0?, all bits are set to input port. figure 4-20 port a s 1wvrwvncvej direction control (on bit basis) pacr ytkvg pa ytkvg 4gugv function control (on bit basis) pafc ytkvg pa tgcf pa0 (tb2in0/int1) pa1 (tb2in1/int2) tb2in0, int1 tb2in1, int2 s b 5gngevqt a s 1wvrwvncvej direction control (on bit basis) pacr ytkvg function control (on bit basis) pafc ytkvg pa ytkvg 4gugv pa tgcf 6kogt f/f out tb02ut0: tmrb2 tb02ut1: tmrb2 pa2 (tb2out0) pa3 (tb2out1) a s 5gngevqt b b 5gngevqt s internal data bus
page 81 2007-10-15 tmp91fw60 note: / is bit x of each register pafc/pacr. port a register 76543210 pa (0028h) bit symbol ? ? ? ? pa3 pa2 pa1 pa0 read/write ? ? ? ? r/w after reset ? ? ? ? data from external port (output latch register is set to ?1?.) port a control register ( read-modify-write instructions are prohibited.) 76543210 pacr (002ah) bit symbol ? ? ? ? pa3c pa2c pa1c pa0c read/write ? ? ? ? w after reset????0000 function ? ? ? ? 0: input 1: output port a function register ( read-modify-write instructions are prohibited.) 76543210 pafc (002bh) bit symbol ? ? ? ? pa3f pa2f pa1f pa0f read/write ? ? ? ? w after reset????0000 function ? ? ? ? 0: port 1: tb2out1 0:port 1: tb2out0 0: port 1: tb2in1, int2 0: port 1: tb2in0, int1 paxc paxf pa3 function pa2 function pa1 function pa0 function 0 0 input port input port input port input port 0 1 output port output port output port output port 1 0 reserved reserved tb2in1/ int2 tb2in0/int1 1 1 tb2out1 tb2out0 reserved reserved
page 82 2007-10-15 tmp91fw60 4.12 port b (pb0 to pb3) port b is an 4-bit general-purpose i/o port. reset operation initializes to input port. all bits of output latch register pb are set to ?1?. there are the following functions in addition to an i/o port. this function enable each function by writing ?1? to applicable bit of port b function register pbfc. ? the i/o function of 16-bit timer 4 (tb4in0,tb4in1,tb4out0,tb4out1) ? the input function of external interrupt (int9, int10) ? the i/o function of serial bus interface 1 (sda1, scl1) reset operation initializes, p bcr and pbfc to ?0?, all bi ts are set to input port. figure 4-21 port b0 and b1 sda1 qwvrwv scl1 qwvrwv a b s a b s pb0(tb4in0,int9,sda1) pb1(tb4in1,int10,scl1) pb tgcf direction control (on bit basis) pbcr write s 1wvrwvncve j 4gugv tb4in0,int9 tb4in1,int10 sda1 kprwv scl1 kprwv 2$(% pbfc write internal data bus function control 2 (on bit basis) pbfc2 write pb write function control (on bit basis) 5gngevqt 5gngevqt open-drain possible: ode
page 83 2007-10-15 tmp91fw60 figure 4-22 port b2 and b3 tb4out0 qwvrwv tb4out1 qwvrwv  a b s 5gngevqt a b s pb2(tb4out0) pb3(tb4out1) pb tgcf direction control (on bit basis) pbcr write function control (on bit basis) pbfc write s 1 wvrwvncvej pb write 4gugv 5gngevqt internal data bus
page 84 2007-10-15 tmp91fw60 note: / is bit x of each register pbfc/pbcr. port b register 76543210 pb (002ch) bit symbol ? ? ? ? pb3 pb2 pb1 pb0 read/write ? ? ? ? r/w after reset ? ? ? ? data from external port (output latch register is set to ?1?.) port b control register ( read-modify-write instructions are prohibited. ) 76543210 pbcr (002eh) bit symbol ? ? ? ? pb3c pb2c pb1c pb0c read/write ? ? ? ? w after reset????0000 function ? ? ? ? 0: input 1: output port b function register ( read-modify-write instructions are prohibited. ) 76543210 pbfc (002fh) bit symbol ? ? ? ? pb3f pb2f pb2f pb0f read/write ? ? ? ? w after reset????0000 port b function register 2 ( read-modify-write instructions are prohibited. ) 76543210 pbfc2 (002dh) bit symbol??????pb1f2pb0f2 read/write ? ????? w after reset??????00 pbxc pbxf pbxf2 pb3 function pb2 function pb1 function pb0 function 0 0 0 input port input port input port input port 1 0 0 output port output port output port output port 0 1 0 reserved reserved tb4in1/int10 tb4in0/int9 1 1 0 tb4out1 tb4out0 reserved reserved 0 0 1 reserved reserved reserved reserved 1 0 1 reserved reserved scl1 sda1 0 1 1 reserved reserved reserved reserved 1 1 1 reserved reserved reserved reserved
page 85 2007-10-15 tmp91fw60 4.13 port z (pz0 to pz3) port z is a 4-bit general-purpose i/o port (however pz0 and pz1 are only output port). each bit can be set individ- ually for input or output using the control register pzcr and function register pzfc. reset operation initializes all bits of output latch pz to ?1?, and the control register pzcr and function register pzfc to ?0?. and pz0 and pz1 output ?high?, and sets pz2 and pz3 to input port with pull-up resister. in addition to functioning as a general-purpose i/o port, port z can also function as the output for the cpu?s con- trol/status signal. if pz0 is defined as rd signal output mode ( = ?1?) and the ou tput latch register

is cleared to ?0?, rd strobe of pz0 is outputted (for pseudo sta tic ram) even when acces sing internal address. if remains ?1?, rd strobe signal is output only wh en external address area is accessed. figure 4-23 port z0 and z1 direction control (on bit basis) ? pzfc ytkvg pz ytkvg pz tgcf rd, wr 4gugv s a b s 1wvrwvncvej pz0 (rd) pz1 (wr) selector output buffer
page 86 2007-10-15 tmp91fw60 figure 4-24 port z2 and z3 function control (on bit basis) s 1wvrwvncvej pz2( hwr )  hwr   pzcr write pzfc write  pz write pz read s a b s pz3(r/ w )  r/ w   s a b p-ch (programmable pull up) p-ch (programmable pull up) output buffer output buffer pz read selector selector internal data bus internal data bus reset reset function control (on bit basis) direction control (on bit basis) direction control (on bit basis) pz write pzfc write pzcr write 1wvrwvncvej
page 87 2007-10-15 tmp91fw60 note 1: / is bit x of each register pzfc/pzcr. note 2: when port z is used as input mode, pz register controls internal pull-up resist or. read-modify-write instruction is proh ib- ited in input mode or i/o mode. setting the internal pull- up resistor may be depended on the states of the input pin. port z register 76543210 pz (007dh) bit symbol ? ? ? ? pz3 pz2 pz1 pz0 read/write ? ? ? ? r/w after reset ? ? ? ? data from external port (output latch register is set to ?1?.) 11 function ? 0 (output latch register): pull-up resistor off 1 (output latch register): pull-up resistor on output mode port z control register ( read-modify-write instructions are prohibited. ) 76543210 pzcr (007eh) bit symbol ? ? ? ? pz3c pz2c ? ? read/write ? ? ? ? w ? ? after reset????00?? function ? 0:input 1:output port z function register ( read-modify-write instructions are prohibited. ) 76543210 pzfc (007fh) bit symbol ? ? ? ? pz3f pz2f pz1f pz0f read/write ? ? ? ? w after reset????0000 function ? ? ? ? 0: port 1:r/ w 0: port 1: hwr 0: port 1: wr 0: port 1: rd pzxf pzxc pzx pz3 function pz2 function pz1 function pz0 function 0 0 0 input port input port output ?0?. output ?0?. 0 0 1 input port input port output ?1?. output ?1?. 0 1 0 output port output port output ?0?. output ?0?. 0 1 1 output port output port output ?1?. output ?1?. 100r/w reserved wr is output only during external accesses. always output rd .(corre- spond to pseudo sram) 101r/w reserved wr is output only during external accesses. rd is output only during external accesses. 1 1 0 reserved hwr wr is output only during external accesses. always output rd .(corre- spond to pseudo sram) 1 1 1 reserved hwr wr is output only during external accesses. rd is output only during external accesses.
page 88 2007-10-15 tmp91fw60 4.14 open-drain control p30,p31,p41,p90,p93,pb0,pb1 can perform selection of an open-drain output per bit. reset operation initializes all bits of the control register ode to ?0? and sets to cmos output. open-drain control register 76543210 ode (003fh) bit symbol ? odeb1 odeb0 ode93 ode90 ode41 ode31 ode30 read/write ? r/w after reset ? 0000000 function 0: cmos output 1:open drain output
page 89 2007-10-15 tmp91fw60 5. chip select/wait controller on the tmp91fw60, four user specifiab le address areas (cs0 to cs3) can be set. the data bus width and the number of waits can be set independently fo r each address area (cs0 to cs3 and others). the pins cs0 to cs3 (which can also function as port pins p40 to p43) are the respective output pins for the areas cs0 to cs3. when the cpu specifies an addr ess in one of these ar eas, the corresponding cs0 to cs3 pin outputs the chip select signal for the specified ad dress area (in rom or sram). however, in order for the chip select signal to be output, the port 6 function regi ster p4fc,p4fc2 must be set. the areas cs0 to cs3 are defined by the values in the memory start address registers msar0 to msar3 and the memory address mask registers mamr0 to mamr3. the chip select/wait control registers b0cs to b3cs and bexcs should be used to specify the master enable/dis- able status the data bus width and th e number of waits for each address area. the input pin controlling these states is the bus wait request pin ( wa i t ). 5.1 specifying an address area the cs0 to cs3 address areas are sp ecified using the start address regi sters (msar0 to msar3) and memory address mask register s (mamr0 to mamr3). at each bus cycle, a compare operation is performed to determine if the addr ess on the specified a location in the cs0 to cs3 area. if the result of the comparison is a matc h, this indicates an access to the corresponding cs area. in this case, the cs0 to cs3 pin outputs the chip select signal and the bus cycle operate s in accordance w ith the settings in chip select/wait control registers b0cs to b3cs. (see" 5.2 chip select/wait control registers ".) 5.1.1 memory start address registers the memory start address registers msar0 to msar3 set the start addre sses for the cs0 to cs3 areas. set the upper 8 bits (a23 to a16) of the start address in . the lower 16 bits of the start address (a15 to a0) are permanently set to 0. accordingly, the start address can only be set in 64-kbyte increments, starting from 000000h. figure 5-1 shows the relationship between the start addr ess and the start address register value. memory start address registers (for areas cs0 to cs3) 76543210 msar0 (00c8h) msar1 (00cah) msar2 (00cch) msar3 (00ceh) bit symbol s23 s22 s21 s20 s19 s18 s17 s16 read/write r/w after reset11111111 function determine a23 to a16 of start address (set start addresses for areas cs0 to cs3.)
page 90 2007-10-15 tmp91fw60 figure 5-1 relationship betw een start address and star t address register value 5.1.2 memory addr ess mask registers memory address mask registers ma mr0 to mamr3 are used to set th e size of the cs0 to cs3 areas by specifying a mask for each bit of the start address se t in memory start address registers mamr0 to mamr3. the compare operation used to determ ine if an address is in the cs0 to cs3 areas is only performed for bus address bits corresponding to bits set to ?0? in these registers. also, the address bits that can be masked by mamr0 to mamr3 differ between cs0 to cs3 areas. accordingly, the size that can be each area is different. note: range of possible settings for cs0 area size: 256 bytes to 2 mbytes. note: range of possible settings for cs1 area size: 256 bytes to 4 mbytes. note: range of possible settings for cs2 and cs3 area sizes: 32 kbytes to 8 mbytes. memory address mask register (for cs0 area) 76543210 mamr0 (00c9h) bit symbol v20 v19 v18 v17 v16 v15 v14 to v9 v8 read/write r/w after reset11111111 function set size of cs0 area 0: used for address compare memory address mask register (cs1) 76543210 mamr1 (00cbh) bit symbol v21 v20 v19 v18 v17 v16 v15 to v9 v8 read/write r/w after reset11111111 function set size of cs1 area 0: used for address compare memory address mask register (cs2, cs3) 76543210 mamr2 (00cdh) mamr3 (00cfh) bit symbol v22 v21 v20 v19 v18 v17 v16 v15 read/write r/w after reset11111111 function set size of cs1 area 0: used for address compare address 000000h ffffffh 000000h 010000h 020000h 030000h 040000h 050000h 060000h to ff0000h 00h 01h 02h 03h 04h 05h 06h to ffh start address value in start address register (msar0 to msar3) 64 kbytes
page 91 2007-10-15 tmp91fw60 5.1.3 setting memory star t addresses and address areas figure 5-2 shows an example of specifying a 64-kbyte addr ess area starting from 010000h using the cs0 areas. set ?01h? in memory start address register msar0 (corresponding to the upper 8 bits of the start address). next, calculate the difference between the st art address and the anticipat ed end address (01ffffh). bits 20 to 8 of the result correspond to the mask value to be set for the cs0 area. setting this value in memory address mask register mamr0 sets the area size. this example sets ?07h? in ma mr0 to specify a 64-kbyte area. figure 5-2 example showi ng how to set the cs0 area after a reset, msar0 to msar3 and mamr0 to ma mr3 are set to ?ffh?. b0cs, b1cs and b3cs are reset to ?0?. this disables the cs 0, cs1 and cs3 areas. however, as b2cs to ?0? and b2cs to ?1?, cs2 is enabled ?002000 to fdffff? in tmp91fw60. also, the bus width and num- ber of waits specified in bexcs are used for accessi ng addresses outside the specified cs0 to cs3 area. 1 tu]&3
l <_, tu]<_, q,"_+,2 .3o o tu] ,2o; <_, cs0 $4f (- (64 k c; ) "07h"  .3o???a 64 k c;$4f 0oa?? 00000001 0000000111111111 s23 s22 s21 s20 s19 s18 s17 s16 v20 v19 v18 v17 v16 v15 v14 ~ v9 v8 01ffff 01h 11111111 07h msar0 00000000 1 1 1 111111111111 msmr0 h
page 92 2007-10-15 tmp91fw60 5.1.4 address area si ze specification table 5-1 shows the relationship between cs area and area size. ? ? indicates areas that cannot be set by memory start address register and a ddress mask register combinations. wh en setting an area size using a com- bination indicated by ? ?, set the start address mask register in the desired steps starting from 000000h. if the cs2 area is set to 16 mbytes or if two or mo re areas overlap, the smaller cs area number has the higher priority. 5.1.4.1 to set the area size for cs0 to 128 kbytes: note: ? ? indicates areas that cannot be set by memory start address register and address mask register combinations. example: valid start addresses 000000h any of these addresses may be set as the start address. (128 kbytes) 020000h (128 kbytes) 040000h (128 kbytes) 060000h : example: invalid start addresses 000000h this is not an integer multiple of the desired area size setting. hence, none of these addresses can be set as the start address. (64 kbytes) 010000h (128 kbytes) 030000h (128 kbytes) 050000h : table 5-1 valid area sizes for each cs area size (bytes) 256 512 32 k 64 k 128 k 256 k 512 k 1 m 2 m 4 m 8 m cs area cs0 ???????? cs1 ? ?????? cs2 ???????? cs3 ????????
page 93 2007-10-15 tmp91fw60 5.2 chip select/wait control registers the master enable/disable, chip se lect output waveform, data bus wi dth and number of wait states for each address area (cs0 to cs3 and others) are set in their respec tive chip select/wait control re gisters, b0cs to b3cs and bexcs. chip select/wait control registers 76543210 b0cs (00c0h) rmw instructions are prohib- ited. bit symbol b0e - b0om1 b0om0 b0bus b0w2 b0w1 b0w0 read/write w - w after reset0 - 000000 function 0: disable 1: enable chip select output waveform selection 00: for rom/sram 01: don?t care 10: don?t care 11: don?t care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait b1cs (00c1h) rmw instructions are prohib- ited. bit symbol b1e - b1om1 b1om0 b1bus b1w2 b1w1 b1w0 read/write w - w after reset0 - 000000 function 0: disable 1: enable chip select output waveform selection 00: for rom/sram 01: don?t care 10: don?t care 11: don?t care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait b2cs (00c2h) rmw instructions are prohib- ited. bit symbol b2e b2m b2om1 b2om0 b2bus b2w2 b2w1 b2w0 read/write w w after reset10000000 function 0: disable 1: enable cs2 area selection 0: 16-mbyte area 1: cs area chip select output waveform selection 00: for rom/sram 01: don?t care 10: don?t care 11: don?t care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait b3cs (00c3h) rmw instructions are prohib- ited. bit symbol b3e - b3om1 b3om0 b3bus b3w2 b3w1 b3w0 read/write w - w after reset0 - 000000 function 0: disable 1: enable chip select output waveform selection 00: for rom/sram 01: don?t care 10: don?t care 11: don?t care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait master enable bit cs2 area selection bne (n = 0 to 3) 0 disable b2m 0 16-mbyte area 1 enable 1 specified address area chip select output waveform selection data bus width selection bnom1:0 (n = 0 to 3) 00 for rom/sram bnbus (n = 0 to ex) 0 16-bit data bus 01 don?t care 1 8-bit data bus 10 11
page 94 2007-10-15 tmp91fw60 5.2.1 master enable bits bit7 (, , or ) of a chip select /wait control register is the master bit which is used to enable or disable settings for the corresponding addres s area. writing ?1? to this bit enables the settings. reset disables (sets to ?0?) , and , and enabled (sets to ?1?) . this enables area cs2 only. 5.2.2 data bus width selection bit3 (, , , or ) of a chip sel ect/wait control register specifies the width of the data bus. this bit should be set to ?0? when memory is to be accessed using a 16-bit data bus and to ?1? when an 8-bit data bus is to be used. this process of changing the data bus width accord ing to the address being accessed is known as ?dynamic bus sizing?. for details of this bus operation see table 5-2. 76543210 bexcs (00c7h) rmw instructions are prohib- ited. bit symbol ? ? ? ? bexbus bexw2 bexw1 bexw0 read/write ? ? ? ? w after reset????0000 function data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait number of address area waits bnw2:0 (n = 0 to ex) see" 5.2.3 wait control "
page 95 2007-10-15 tmp91fw60 note:?xxxxx? indicates that the input dat a from these bits are ignored during a read. during a write, indicates that the bus for these bits goes too high impedance; also, t hat the write strobe signal for the bus remains inactive. 5.2.3 wait control bits 0 to 2 (, , , , ) of a chip select/wait control reg- ister specify the number of waits that are to be in serted when the correspondi ng memory area is accessed. the following types of wait operation can be specified using these bits. bit settings other than those listed in the table should not be made. a reset sets these bit to ? 000 ? (2 waits). table 5-2 dynamic bus sizing operand data bus width operand start address memory data bus width cpu address cpu data d15 to d8 d7 to d0 8 bits 2n + 0 (even number) 8 bits 2n + 0 xxxxx b7 to b0 16 bits 2n + 0 xxxxx b7 to b0 2n + 1 (odd number) 8 bits 2n + 1 xxxxx b7 to b0 16 bits 2n + 1 b7 to b0 xxxxx 16 bits 2n + 0 (even number) 8 bits 2n + 0 2n + 1 xxxxx xxxxx b7 to b0 b15 to b8 16 bits 2n + 0 b15 to b8 b7 to b0 2n + 1 (odd number) 8 bits 2n + 1 2n + 2 xxxxx xxxxx b7 to b0 b15 to b8 16 bits 2n + 1 2n + 2 b7 to b0 xxxxx xxxxx b15 to b8 32 bits 2n + 0 (even number) 8 bits 2n + 0 2n + 1 2n + 2 2n + 3 xxxxx xxxxx xxxxx xxxxx b7 to b0 b15 to b8 b23 to b16 b31 to b24 16 bits 2n + 0 2n + 2 b15 to b8 b31 to b24 b7 to b0 b23 to b16 2n + 1 (odd number) 8 bits 2n + 1 2n + 2 2n + 3 2n + 4 xxxxx xxxxx xxxxx xxxxx b7 to b0 b15 to b8 b23 to b16 b31 to b24 16 bits 2n + 1 2n + 2 2n + 4 b7 to b0 b23 to b16 xxxxx xxxxx b15 to b8 b31 to b24 table 5-3 wait operation settings number of waits wait operation 000 2 waits inserts a wait of 2 states, irrespective of the wait pin state. 001 1 wait inserts a wait of 1 state, irrespective of the wait pin state. 010 (1 + n) waits samples the state of the wait pin after inserting a wait of one state. if the wait pin is low, the waits continue and the bus cycle is extended until the pin goes high. 011 0 waits ends the bus cycle without a wait, regardless of the wait pin state. 100 reserved invalid setting 101 3 waits inserts a wait of 3 state, irrespective of the wait pin state. 110 4 waits inserts a wait of 4 state, irrespective of the wait pin state. 111 8 waits inserts a wait of 8 state, irrespective of the wait pin state.
page 96 2007-10-15 tmp91fw60 5.2.4 bus width and wait control for an area other than cs0 to cs3 the chip select/wait control register bexcs controls the bus width and number of waits when memory loca- tions which are not in one of the four user-specified address areas (cs0 to cs3) are accessed. the bexcs reg- ister settings are always enabled for areas other than cs0 to cs3. 5.2.5 selecting 16-mbyte area/specified address area setting b2cs (bit6 of the chip select/wait cont rol register for cs2) to ?0? designates the 16-mbyte area ?002000 to fdffff? as the cs2 area. setting b2cs to ?1? designates the address area specified by the start address register msar2 and the address mask register mamr2 as cs2 (e.g., if b2cs = 1, cs2 is specified in the same ma nner as cs0, cs1 and cs3 are). a reset clears this bit to ?0?, speci fying cs2 as a 16-mbyte address area. 5.2.6 procedure for settin g chip select/wait control when using the chip select/wai t control function, set the registers in the following order: 1. set the memory start addres s registers msar0 to msar3. set the start addresses for cs0 to cs3. 2. set the memory address mask registers mamr0 to mamr3. set the sizes of cs0 to cs3. 3. set the chip select/wait cont rol registers b0cs to b3cs. set the chip select output waveform, data bus width, number of waits and master enable/disable status for cs0 to cs3 . the cs0 to cs3 pins can also function as pins p40 to p 43. to output a chip select signal using one of these pins, set the corresponding bit in the port 6 function register p4fc/p4fc2 to ?1?. if a cs0 to cs3 address is specifi ed which is actually an internal i/o and ram area address, the cpu accesses the internal address area and no chip select signal is output on any of the cs0 to cs3 pins. example :in this example cs0 is set to the 64-kbyte area 010000h to 01ffffh. the bus width is set to 16 bits and the number of waits is set to 0. ld (msar0), 01h ; start address: 010000h ld (mamr0), 07h ; address area: 64 kbytes ld (b0cs), 83h ; rom/sram, 16-bit data bus, 0 waits, cs0 area settings enabled
page 97 2007-10-15 tmp91fw60 5.3 connecting external memory figure 5-3 shows an example of how to connect external memory to tmp91fw60. in this example the rom is connected using a 16-bit bus. the ram and i/o are connected using an 8-bit bus. figure 5-3 example of ex ternal memory connection (rom uses 16-bit bus, ra m and i/o use 8-bit bus. a reset clears all bits of the port 4 control register p4cr and the port 4 fu nction register p4fc/p4fc2 to ?0? and disables output of the cs signal. to output the cs signal, the appropriate bit must be set to ?1?. oe wr we rd ale ad0~ad7 ad8~ad15 address bus cs2 cs1 cs0 cs upper byte rom oe cs lower byte rom we oe cs 8-bit bus ram oe cs 8-bit bus i/o d le q d le q 74ac573 tmp91fw60
page 98 2007-10-15 tmp91fw60 6. 8-bit timers (tmra) the tmp91fw60 features 6 channels (tmr a0 to tmra5) built-in 8-bit timers. these timers are paired into 3 mo dules: tmra01, tmra23 and tmra45. each module consists of 2 channels and can operate in any of the following 4 operating modes. ? 8-bit interval timer mode ? 16-bit interval timer mode ? 8-bit programmable square wave pulse generation output mode (ppg ? variable duty cycle with variable period) ? 8-bit pulse width modulation output mode (pwm ? variable duty cycle with constant period) figure 6-1 to figure 6-3 show block diagrams for tmra01, tmra23 and tmra45. each channel consists of an 8-bit up counter, an 8-bit comp arator and an 8-bit timer register. in addition, a timer flip-flop and a prescaler are prov ided for each pair of channels. the operation mode and timer flip-flops are controlled by 5-byte registers sfrs (special function registers). each of the three modules (tmra01, tmra23 and tmra45) can be operated independently. all modules oper- ate in the same manner; hence only the operation of tmra01 is explained here. table 6-1 registers and pins for each module specification module tmra01 tmra23 tmra45 external pin input pin for external clock ta0in (shared with p70) none ta4in (shared with p73) output pin for timer flip-flop ta1out (shared with p71) ta3out (shared with p72) ta5out (shared with p74) sfr (address) timer run register ta01run (0100h) ta23run (0108h) ta45run (0110h) timer register ta0reg (0102h) ta1reg (0103h) ta2reg (010ah) ta3reg (010bh) ta4reg (0112h) ta5reg (0113h) timer mode register ta01mod (0104h) ta23mod (010ch) ta45mod (0114h) timer flip-flop control register ta1ffcr (0105h) ta3ffcr (010dh) ta5ffcr (0115h)
page 99 2007-10-15 tmp91fw60 6.1 block diagrams figure 6-1 tmra01 block diagram 8-bit up counter (uc0) timer  flip-flop ta1ff 8-bit comparator (cp0) 2 4 8 16 32 64 128 256 512 8-bit timer register ta0reg register buffer 0 t1 t1 prescaler clock: t0 external input clock: ta0in timer flip-flop output: ta1out tmra0 interrupt output: intta0 tmra1 interrupt output: intta1 tmra0 match output: ta0trg prescaler t4 t4 t16 t16 ta01mod ta1ffcr ta01mod ta01run ta01mod ta01mod ta0trg ta01run ta01run t256 ta01run run/clear 2 n overflow 8-bit comparator (cp1) 8-bit up counter (uc1) 8-bit timer register ta1reg match detect match detect selector t1 t16 t256 selector internal data bus internal data bus
page 100 2007-10-15 tmp91fw60 figure 6-2 tmra23 block diagram 8-bit up counter (uc2) timer flip-flop ta3ff 8-bit comparator (cp2) 2 4 8 16 32 64 128 256 512 8-bit timer register ta2reg register buffer 2 t1 t1 prescaler clock: t0 timer flip-flop output: ta3out tmra2 interrupt output: intta2 tmra3 interrupt output: intta3 tmra2 match output: ta2trg prescaler t4 t4 t16 t16 ta23mod ta3ffcr ta23mod ta23run ta23mod ta23mod ta2trg ta23run ta23run t256 ta23run run/clear 2 n overflow 8-bit comparator (cp3) 8-bit up counter (uc3) 8-bit timer register ta3reg match detect match detect selector t1 t16 t256 selector internal data bus internal data bus
page 101 2007-10-15 tmp91fw60 figure 6-3 tmra45 block diagram 8-bit up counter (uc4) timer  flip-flop ta5ff 8-bit comparator (cp4) 2 4 8 16 32 64 128 256 512 8-bit timer register ta4reg register buffer 4 t1 t1 prescaler clock: t0 external input clock: ta4in timer flip-flop output: ta5out tmra4 interrupt output: intta4 tmra5 interrupt output: intta5 tmra4 match output: ta4trg prescaler t4 t4 t16 t16 ta45mod ta5ffcr ta45mod ta45run ta45mod ta45mod ta4trg ta45run ta45run t256 ta45run run/clear 2 n overflow 8-bit comparator (cp5) 8-bit up counter (uc5) 8-bit timer register ta5reg match detect match detect selector t1 t16 t256 selector internal data bus internal data bus
page 102 2007-10-15 tmp91fw60 6.2 operation of each circuit 6.2.1 prescalers a 9-bit prescaler generates the input clock to tmra01. the ? t0? as the input clock to prescaler is a clock divided by 4 which is selected using the prescaler clock selection register syscr0. the prescaler?s operation can be controlled using ta01run in the timer control register. set- ting to ?1? starts the count; setting to ?0? clears the prescaler to ?0? and stops operation. table 6-2 shows the various prescaler output clock resolutions. note: xxx: don?t care 6.2.2 up counters (uc0 and uc1) these are 8-bit binary counters which count up the input clock pulses for the clock specified by ta01mod. the input clock for uc0 is selectable and can be either the external clock input via the ta0in pin or one of the three internal clocks t1, t4, or t16. the clock setting is specified by the value set in ta01mod. the input clock for uc1 depends on the operation mode. in 16-bit timer mode, the overflow output from uc0 is used as the input clock. in any mode other than 16-bit timer mode, the input clock is selectable and can either be one of the internal clocks t1, t16 or t256, or the comparator output (the match detection signal) from tmra0. for each interval timer the timer operation control register bits ta01run and ta01run can be used to stop and clear the up counters and to control th eir count. a reset clears both up counters, stopping the timers. table 6-2 prescaler output clock resolution @ fc = 20 mhz, fs = 32.768 khz system clock selection syscr1 gear value syscr1 prescaler clock selection syscr0 prescaler output clock resolution t1 (1/2) t4 (1/8) t16 (1/32) t256 (1/512) 1 (fs) xxx 0 (1/1) f fph 2 3 /fs (244 s) 2 5 /fs (977 s) 2 7 /fs (3.9 ms) 2 11 /fs (62.5 ms) 0 (fc) 000 (fc) 2 3 /fc (0.4 s) 2 5 /fc (1.6 s) 2 7 /fc(6.4 s) 2 11 /fc (102.4 s) 001 (fc/2) 2 4 /fc (0.8 s) 2 6 /fc (3.2 s) 2 8 /fc (12.8 s) 2 12 /fc (204.8 s) 010 (fc/4) 2 5 /fc (1.6 s) 2 7 /fc (6.4 s) 2 9 /fc (25.6 s) 2 13 /fc (409.6 s) 011 (fc/8) 2 6 /fc (3.2 s) 2 8 /fc (12.8 s) 2 10 /fc (51.2 s) 2 14 /fc (819.2 s) 100 (fc/16) 2 7 /fc (6.4 s) 2 9 /fc (25.6 s) 2 11 /fc (102.4 s) 2 15 /fc (1638.4 s) xxx 1 (1/16) fc/16 clock 2 7 /fc (6.4 s) 2 9 /fc (25.6 s) 2 11 /fc (102.4 s) 2 15 /fc (1638.4 s)
page 103 2007-10-15 tmp91fw60 6.2.3 timer register s (ta0reg and ta1reg) these are 8-bit registers which can be used to set a ti me interval. when the value set in the timer register ta0reg or ta1reg matches the value in the correspond ing up counter, the compar ator match detect signal goes active. if the value set in the timer register is 00 h, the signal goes active when the up counter overflows. the ta0reg are double buffer structure, each of which makes a pair with register buffer. the setting of the bit ta01run determines whether ta0reg?s double buffer structure is enabled or disabled. it is di sabled if = ?0? a nd enabled if = ?1?. when the double buffer is enabled, data is transferred fr om the register buffer to the timer register when a 2 n overflow occurs in pwm mode, or at the start of the ppg cycle in ppg mode. hence the double buffer cannot be used in timer mode. a reset initializes to ?0?, disabling the double buffer. to use the double buffer, write data to the timer register, set to ?1?, and write the follow ing data to the register buffer. figure 6-4 shows the configuration of ta0reg. figure 6-4 configuration of ta0reg note:the same memory address is allocated to the timer register ta0reg and the register buffer 0. when = 0, the same value is written to the r egister buffer 0 and the timer register ta0reg; when = 1, only the register buffer 0 is written to. write selector shift trigger matching detection in ppg cycle 2 n overflow pwm timer registers 0 (ta0reg) register buffers 0 internal data bus s y a b write to ta0reg ta01run
page 104 2007-10-15 tmp91fw60 6.2.4 comparator (cp0 and cp1) the comparator compares the value in an up counter with the value set in a timer register. if they match, the up counter is cleared to 0 and an interrupt signal (intta0 or intta1) is generated. if timer flip-flop inversion is enabled, the timer flip-flop is inverted at the same time. note:if a value smaller than the up-counter value is written to the timer register while the timer is counting up, this will cause the timer to overflow and an interrupt cannot be generated at the expected time. (the value in the timer register can be changed without any problem if the new value is larger than the up-counter value.) in 16- bit interval timer mode, be sure to write to both ta0reg and ta1reg in this order (16 bits in total), the com- pare circuit will not function if only the lower 8 bits are set. 6.2.5 timer flip-flop (ta1ff) the timer flip-flop (ta1ff) is a flip-flop inverted by the match detects signal (8-bit comparator output) of each interval timer. whether inversion is enabled or disabled is determined by the setting of the bit ta1ffcr in the timer flip-flop control register. a reset clears the value of ta1ff1 to ?0?. writing ?01? or ?10? to ta1ffcr sets ta1 ff to 0 or 1. writing ?00? to these bits inverts the value of ta1ff (this is known as software inversion). the ta1ff signal is output via the ta1out pin (concurrent with p71). when this pin is used as the timer output, the timer flip-flop should be set beforehand using the port 7 function registers p7cr, p7fc. note: if an inversion by the match-detect signal and a setting c hange via the tmra1 flip-flop cont rol register occur simulta- neously, the resultant operation varies depending on the situation, as shown below. ? if an inversion by the match-detect signal and an inversion via the register occu r simultaneously, the flip-flop will be inverted only once. ? if an inversion by the match-detect signal and an atte mpt to set the flip-flop to 1 via the register occur simultaneously, the timer flip-flop will be set to 1. ? if an inversion by the match-detect signal and an atte mpt to clear the flip-flop to 0 via the register occur simultaneously the flip-flop will be cleared to 1. be sure to stop the timer before changing the flip-flop insertion setting. if the setting is changed while the timer is counting, proper operation cannot be obtained. the condition for ta1ff inversion varies with mode as shown below 8-bit interval timer mode : uc0 matches ta0reg or uc1 matches ta1reg (select either one of the two) 16-bit interval timer mode : uc0 matches ta0reg or uc1 matches ta1reg 8 bit pwm mode : uc0 matches ta0reg or a 2n overflow occurs 8 bit ppg mode : uc0 matches ta0reg or uc0 matches ta1reg
page 105 2007-10-15 tmp91fw60 6.3 sfr note: the values of bits 4 to 6 of ta01run are "1" when read. note: the values of bits 4 to 6 of ta23run are "1" when read. note: the values of bits 4 to 6 of ta45run are "1" when read. tmra01 run register 76543210 ta01run (0100h) bit symbol ta0rde ? ? ? i2ta01 ta01prun ta1run ta0run read/write r/w ? ? ? r/w after reset0???0000 function double buffer 0: disable 1: enable idle2 0: stop 1: operate tmra01 prescaler up counter (uc1) up counter (uc0) 0: stop and clear 1: run (count up) count operation ta0reg double buffer control ta01prun ta1run / ta0run 0 stop and clear ta0rde 0 disable 1 run (count up) 1 enable tmra23 run register 76543210 ta23run (0108h) bit symbol ta2rde ? ? ? i2ta23 ta23prun ta3run ta2run read/write r/w ? ? ? r/w after reset0???0000 function double buffer 0: disable 1: enable idle2 0: stop 1: operate tmra23 prescaler up counter (uc3) up counter (uc2) 0: stop and clear 1: run (count up) count operation ta2reg double buffer control ta23prun ta3run / ta2run 0 stop and clear ta2rde 0 disable 1 run (count up) 1 enable tmra45 run register 76543210 ta45run (0110h) bit symbol ta4rde ? ? ? i2ta45 ta45prun ta5run ta4run read/write r/w ? ? ? r/w after reset0???0000 function double buffer 0: disable 1: enable idle2 0: stop 1: operate tmra45 prescaler up counter (uc5) up counter (uc4) 0: stop and clear 1: run (count up) count operation ta4reg double buffer control ta45prun ta5run / ta4run 0 stop and clear ta4rde 0 disable 1 run (count up) 1 enable
page 106 2007-10-15 tmp91fw60 tmra01 mode register 76543210 ta01mod (0104h) bit symbol ta01m1 ta01m0 pwm01 pwm00 ta1clk1 ta1clk0 ta0clk1 ta0clk0 read/write r/w after reset00000000 function operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 input clock for tmra1 00: ta0trg 01: t1 10: t16 11: t256 input clock for tmra0 00: ta0in pin 01: t1 10: t4 11: t16 tmra0 input clock selection 00 ta0in?? 01 t1 10 t4 11 t16 tmra1 input clock selection ta01mod 01 ta01mod = 01 00 comparator output from tmra0 overflow output from tmra0 (16-bit timer mode) 01 t1 10 t16 11 t256 pwm cycle selection 00 reserved 01 2 6 clock source 10 2 7 clock source 11 2 8 clock source tmra01 operation mode selection 00 8-bit timers 2ch 01 16-bit timer 10 8-bit ppg 11 8-bit pwm (tmra0) + 8-bit timer (tmra1)
page 107 2007-10-15 tmp91fw60 tmra23 mode register 76543210 ta23mod (010ch) bit symbol ta23m1 ta23m0 pwm21 pwm20 ta3clk1 ta3clk0 ta2clk1 ta2clk0 read/write r/w after reset00000000 function operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 input clock for tmra3 00: ta2trg 01: t1 10: t16 11: t256 input clock for tmra2 00: reserved 01: t1 10: t4 11: t16 tmra2 input clock selection 00 reserved 01 t1 10 t4 11 t16 tmra3 input clock selection ta23mod 01 ta23mod = 01 00 comparator output from tmra2 overflow output from tmra2 (16-bit timer mode) 01 t1 10 t16 11 t256 pwm cycle selection 00 reserved 01 2 6 clock source 10 2 7 clock source 11 2 8 clock source tmra23 operation mode selection 00 8-bit timers 2ch 01 16-bit timer 10 8-bit ppg 11 8-bit pwm (tmra2) + 8-bit timer (tmra3)
page 108 2007-10-15 tmp91fw60 tmra45 mode register 76543210 ta45mod (0114h) bit symbol ta45m1 ta45m0 pwm41 pwm40 ta5clk1 ta5clk0 ta4clk1 ta4clk0 read/write r/w after reset00000000 function operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 input clock for tmra5 00: ta4trg 01: t1 10: t16 11: t256 input clock for tmra4 00: ta4in pin 01: t1 10: t4 11: t16 tmra4 input clock selection 00 ta4in 01 t1 10 t4 11 t16 tmra5 input clock selection ta45mod 01 ta45mod = 01 00 comparator output from tmra4 overflow output from tmra4 (16-bit timer mode) 01 t1 10 t16 11 t256 pwm cycle selection 00 reserved 01 2 6 clock source 10 2 7 clock source 11 2 8 clock source tmra45 operation mode selection 00 8-bit timers 2ch 01 16-bit timer 10 8-bit ppg 11 8-bit pwm (tmra4) + 8-bit timer (tmra5)
page 109 2007-10-15 tmp91fw60 note: the values of bits 4 to 7 of ta1ffcr are "1" when read. note: the values of bits 4 to 7 of ta3ffcr are "1" when read. tmra1 flip-flop control register 76543210 ta1ffcr (0105h) bit symbol ? ? ? ? ta1ffc1 ta1ffc0 ta1ffie ta1ffis read/write ? ? ? ? r/w r/w after reset????1100 function 00: invert ta1ff 01: set ta1ff 10: clear ta1ff 11: don?t care ta1ff control for inversion 0: disable 1: enable ta1ff inversion select 0: tmra0 1:tmra1 inverse signal for timer flip-flop 1 (ta1ff ) (don?t care except in 8-bit timer mode) ta1ffis 0 inversion by tmra0 1 inversion by tmra1 inversion of ta1ff ta1ffie 0 disabled 1 enabled control of ta1ff 00 inverts the value of ta1ff (software inversion) 01 sets ta1ff to ?1? 10 clears ta1ff to ?0? 11 don?t care tmra3 flip-flop control register 76543210 ta3ffcr (010dh) bit symbol ? ? ? ? ta3ffc1 ta3ffc0 ta3ffie ta3ffis read/write ? ? ? ? r/w r/w after reset????1100 function 00: invert ta3ff 01: set ta3ff 10: clear ta3ff 11: don?t care ta3ff control for inversion 0: disable 1: enable ta3ff inversion select 0: tmra2 1:tmra3 inverse signal for timer flip-flop 3 (ta3ff ) (don?t care except in 8-bit timer mode) ta3ffis 0 inversion by tmra2 1 inversion by tmra3 inversion of ta3ff ta3ffie 0 disabled 1 enabled control of ta3ff 00 inverts the value of ta3ff (software inversion) 01 sets ta3ff to ?1? 10 clears ta3ff to ?0? 11 don?t care
page 110 2007-10-15 tmp91fw60 note: the values of bits 4 to 7 of ta5ffcr are "1" when read. tmra5 flip-flop control register 76543210 ta5ffcr (0115h) bit symbol ? ? ? ? ta5ffc1 ta5ffc0 ta5ffie ta5ffis read/write ? ? ? ? r/w r/w after reset????1100 function 00: invert ta5ff 01: set ta5ff 10: clear ta5ff 11: don?t care ta5ff control for inversion 0: disable 1: enable ta5ff inversion select 0: tmra4 1:tmra5 inverse signal for timer flip-flop 5 (ta5ff ) (don?t care except in 8-bit timer mode) ta5ffis 0 inversion by tmra4 1 inversion by tmra5 inversion of ta5ff ta5ffie 0 disabled 1 enabled control of ta5ff 00 inverts the value of ta5ff (software inversion) 01 sets ta5ff to ?1? 10 clears ta5ff to ?0? 11 don?t care timer register 76543210 ta0reg (0102h) bit symbol ? read/write w after reset 0 ta1reg (0103h) bit symbol ? read/write w after reset 0 ta2reg (010ah) bit symbol ? read/write w after reset 0 ta3reg (010bh) bit symbol ? read/write w after reset 0 ta4reg (0112h) bit symbol ? read/write w after reset 0 ta5reg (0113h) bit symbol ? read/write w after reset 0
page 111 2007-10-15 tmp91fw60 6.4 operation in each mode 6.4.1 8-bit timer mode both tmra0 and tmra1 can be used independently as 8-bit interval timers. set its function or counter data for tmra0 and tmra1 after stop these registers. 6.4.1.1 generating interrupts at a fixed interval (using tmra1) to generate interrupts at constant intervals using tmra1 (intta1), first stop tmra1 then set the operation mode, input clock and a cycle to ta01mod and ta1reg regi ster, respectively. then, enable the interrupt intta1 and start tmra1 counting. note: x: don?t care, ?: no change select the input clock using table 6-2. note: the input clocks for tmra0 and tm ra1 are different from as follows. tmra0: ta0in input, t1, t4 or t16 tmra1: match output of tmra0, t1, t16, t256 example: to generate an intta1 interrupt every 12 s at fc = 20 mhz, set e ach register as follows: * clock state system clock : high frequency (fc) prescaler clock : f fph clock gear : 1 (fc) msb lsb 76543210 ta01run ?xxx??0?stop tmra1 and clear it to 0. ta01mod 00xx01xx select 8-bit timer mode and select t1 (0.4 s at fc = 20 mhz) as the input clock. ta1reg 00011110set ta1reg to 12 s t1 = 30 = 1eh inteta01 x 1 0 1 x ? ? ? enable intta1 and set it to level 5. ta01run ?xxx?11?start tmra1 c ounting.
page 112 2007-10-15 tmp91fw60 6.4.1.2 generating a 50% duty ratio square wave pulse the state of the timer flip-flop (ta1 ff) is inverted at constant intervals and its status output via the timer output pin (ta1out). note: x: don?t care, ?: no change example: to output a 2.4 s square wave pulse from the ta1out pin at fc = 20 mhz, use the following procedure to make the appropriate register settings . this example uses tmra1; however, either tmra0 or tmra1 may be used. * clock state system clock : high frequency (fc) prescaler clock : f fph clock gear : 1 (fc) msb lsb 76543210 ta01run ?xxx??0?stop tmra1 and clear it to 0. ta01mod 00xx01?? select 8-bit timer mode and select t1 (0.4 s at fc = 20 mhz) as the input clock. ta1reg 00000011set the timer register to 2.4 s t1 2 = 03h ta1ffcr xxxx 1011 clear ta1ff to ?0? and set it to invert on the match detects signal from tmra1. p7cr xxx???1? set p71 to function as the ta1out pin. p7fc xxx???1? ta01run ?xxx?11?start tmra1 counting.
page 113 2007-10-15 tmp91fw60 figure 6-5 square wave ou tput timing chart (50% duty) 6.4.1.3 making tmra1 count up on the match signal from the tmra0 comparator select 8-bit timer mode and set the comparator output from tmra0 to be the input clock to tmra1. figure 6-6 tmra 1 count up on si gnal from tmra0 intta1 ta1ff ta1out bit1 uc1 clear up counter comparator timig comparator output (match detect) bits 7 to 2 ta01run t t1 bit0 0.9 ? s at fc = 20 mhz 333 222 111 0000 2 1 345123 23 451 1 2 1 tmra0 up counter (when ta0reg = 5) tmra1 up counter (when ta1reg = 2) comparator output (tmra0 match) tmra1 match output
page 114 2007-10-15 tmp91fw60 6.4.2 16-bit timer mode a 16-bit interval timer is configured by pairing the two 8-bit timers tmra0 and tmra1. to make a 16-bit interval timer in which tmra0 and tmra1 are cascaded together, set ta01mod to 01. in 16-bit timer mode, the overflow output from tmra0 is used as the input clock for tmra1, regardless of the value set in ta01mod. table 6-2 shows the cycle of the input clock for tmra0. lsb 8-bit set to ta0reg and msb 8- bit is for ta1reg. please keep se tting ta0reg first because setting data for ta0reg inhibit its compare function and setting data for ta1reg permit it. if t16 (2 7 /fc s at fc = 20 mhz) is used as the input clock fo r counting, set the following value in the regis- ters: 0.4 s/(2 7 /fc) s P 62500 = f424h (e.g., set ta1reg to f4h and ta0reg to 24h). as a result, intta1 interrupt can be generated every 0.4 [s]. the comparator match signal is output from tm ra0 each time the up counter uc0 matches ta0reg, though the up counter uc0 is not cleared and also intta0 is not generated. in the case of the tmra1 comparator, the match det ect signal is output on each comparator pulse on which the values in the up counter uc1 and ta1reg match. when the match detect signal is ou tput simultaneously from both th e comparators tmra0 and tmra1, the up counters uc0 and uc1 are cleared to 0 and the interrupt intta1 is generated. also, if inversion is enabled, the value of the timer flip-flop ta1ff is inverted. example: when ta1reg = 04h and ta0reg = 80h figure 6-7 timer output by 16-bit timer mode example: to generate an intta1 interrupt every 0.4 [s] at fc = 20 mhz, set the timer registers ta0reg and ta1reg as follows: * clock state system clock : high frequency (fc) prescaler clock : f fph clock gear : 1 (fc) inversion interrupt intta1 timer output ta1out 0080h 0180h 0280h 0380h 0480h 0080h tmra0 comparator match detect signal value of up counter (uc1, uc0) tmra1 comparator match detect signal interrupt intta0
page 115 2007-10-15 tmp91fw60 6.4.3 8-bit ppg (programmabl e pulse generation) output mode square wave pulses can be generated at any frequency and duty ratio by tmra0. the output pulses may be active low or active high. in this mode tmra1 cannot be used. tmra0 outputs pulses on the ta1out pin. figure 6-8 8-bit ppg output waveforms in this mode, a programmable square wave is genera ted by inverting the timer output each time the 8-bit up counter (uc0) matches the value in one of the timer registers ta0reg or ta1reg. the value set in ta0reg must be smaller than the value set in ta1reg. although the up counter for tmra1 (uc1) is not used in this mode, ta01run should be set to ?1?, so that uc1 is set for counting. figure 6-9 shows a block diagram representing this mode. figure 6-9 block diagram of 8-bit ppg output mode ta1out ta1reg t h t t l ta0reg ta0reg and uc0 match (interrupt intta0) ta1reg and uc0 match (interrupt intta1) t l t t h = "10" = "01" example: = "01" selector selector shift trigger comparator register buffer comparator ta1reg internal data bus ta01run ta0reg-wr 8-bit up counter (uc0) ta1ff ta1out intta0 intta1 ta1ffcr ta01mod ta01run inversion ta0in t1 t4 t16 ta0reg
page 116 2007-10-15 tmp91fw60 if the ta0reg double buffer is enabled in this mode, the value of the register buffer will be shifted into ta0reg each time ta1reg matches uc0. use of the double buffer facilitates the handlin g of low-duty waves (when duty is varied). figure 6-10 operation of register buffer 0 note:the values that can be set in taxreg range from 01h to 00h (equivalent to 100h). if the maximum value 00h is set, the match-detect signal goes ac tive when the up-counter overfolws. example: to generate 1/4-duty 50-khz pulses (at fc = 20 mhz): calculate the value which should be set in the timer register. to obtain a frequency of 50 khz, the pulse cycle t should be: t = 1/50 khz = 20 s t1 = 2 3 /fc s (at fc = 20 mhz); 20 s/(2 3 /fc) s = 50 therefore set ta1reg to 50 (32h), and 50-khz pulses can be obtained. the duty is to be set to 1/4: t 1/4 = 20 s 1/4 = 5 s 5 s/(2 3 /fc) s P 13 therefore, set ta0reg = 13 = 0dh. * clock state system clock : high frequency (fc) prescaler clock : f fph clock gear : 1 (fc) q 2 q 1 match wiht ta1reg ta0reg (value to be compared) q 3 q 2 register buffer shift from register buffer 0 ta0reg (register buffer 0) write (up counter = q 1 ) (up counter = q 2 ) match with ta0reg and up counter 20 ? s
page 117 2007-10-15 tmp91fw60 note:x : don't care ? : no change 76543210 ta01run 0xxx??00 stop tmra0 and tmra01 and clear it to ?0?.(double buffer dis- able) ta01mod 1 0xxxx0 1set the 8-bit ppg m ode, and select t1 as input clock. ta0reg 00001101write 0dh. ta1reg 00110010write 32h. ta1ffcr xxxx0 1 1xset ta1ff, enabling both inversion and the double buffer. writing ?10? provides negative logic pulse. p7cr xxx???1? set p71 as the ta1out pin. p7fc xxx???1? ta01run 1xxx?111start tmra0 and tmra01 counting.(double buffer enable)
page 118 2007-10-15 tmp91fw60 6.4.4 8-bit pwm output mode this mode is only valid for tmra0. in this mode, a pwm pulse with the maximum resolution of 8 bits can be output. when tmra0 is used the pwm pulse is output on the ta1out pin. tmra1 can also be used as an 8-bit timer. the timer output is inverted when the up counter (uc0) matches the value set in the timer register ta0reg or when 2 n counter overflow occurs (n = 6, 7 or 8 as specified by ta01mod). the up counter uc0 is cleared when 2 n counter overflow occurs. the following conditions must be satisfied before this pwm mode can be used. value set in ta0reg < value set for 2 n counter overflow value set in ta0reg 0 figure 6-11 8-bit pwm waveforms figure 6-12 shows a block diagram representing this mode. figure 6-12 block diagr am of 8-bit pwm mode in this mode, the value of the register buffer will be shifted into ta0reg if 2 n overflow is detected when the ta0reg double buffer is enabled. ta1out t pwm ta0reg and  uc0 match 2 n overflow (intta0 interrupt) (pwm cycle) selector selector shift trigger comparator register buffer0 internal data bus ta01run ta0reg-wr 8-bit up counter (uc0) ta1ff ta1out intta0 ta1ffcr ta01mod ta01mod ta01run invert ta0in t1 t4 t16 ta0reg clear overflow 2 n overflow control
page 119 2007-10-15 tmp91fw60 use of the double buffer facilitates the handling of low duty ratio waves. figure 6-13 operation of register buffer 0 example: to output the following pwm waves on the ta1out pin at fc = 20 mhz: to achieve a 51.2 s pwm cycle by setting t1 to 2 3 /fc s (at fc = 20 mhz): 51.2 s/(2 3 /fc) s P 128 = 2 n therefore n should be set to 7. since the low-level period is 29.6 s when t1 = 2 3 /fc s (at fc = 20 mhz), set the following value for ta0reg: 29.6 s/(2 3 /fc) s P 74 = 4ah note:x : don't care ? : no change * clock state system clock : high frequency (fc) prescaler clock : f fph clock gear : 1 (fc) msb lsb 76543210 ta01run ?xxx???0stop tmra0 and clear it to 0. ta01mod 1110??01 select 8-bit pwm mode (cycle: 2 7 ) and select t1 as the input clock. ta0reg 01001010write 4ah. ta1ffcr xxxx1 0 1xclear ta1ff to 0, e nable the inversion and double buffer. p7cr xxx???1? set p71 and the ta1out pin. p7fc xxx???1? ta01run 1xxx?1?1start tmra0 counting. q 2 q 1 2 n overflow ta0reg (value to be compared) q 3 q 2 register buffer 0 shift into ta0reg ta0reg (register buffer 0) write (up counter = q 1 ) (up counter = q 2 ) match with ta0reg
page 120 2007-10-15 tmp91fw60 note: xxx: don't care 6.4.5 settings for each mode table 6-4 shows the sfr settings for each mode. note: ? : don?t care table 6-3 pwm cycle @ fc = 20 m hz, fs = 32.768 khz select sys- tem clock syscr1 gear value syscr1 select prescaler clock syscr0 pwm cycle 2 6 2 7 2 8 t1 t4 t16 t1 t4 t16 t1 t4 t16 1 (fs) xxx 0 (1/1) f fph 15.6 ms 62.5 ms 250 ms 31.3 ms 125 ms 500 ms 62.5 ms 250 ms 1000 ms 0 (fc) 000 (fc) 25.6 s102.4 s 409.6 s51.2 s 204.8 s819.2 s 102.4 s 409.6 s 1638 s 001 (fc/2) 51.2 s204.8 s 819.2 s102.4 s 409.6 s 1638 s 204.8 s 819.2 s 3277 s 010 (fc/4) 102.4 s409.6 s 1638 s204.8 s 810.2 s 3277 s 409.6 s 1638 s 6554 s 011 (fc/8) 204.8 s819.2 s 3277 s409.6 s 1638 s 6554 s 819.2 s 3277 s 13107 s 100 (fc/16) 409.6 s 1638 s 6554 s819.2 s 3277 s 13107 s 1638 s 6554 s 26214 s xxx 1 (1/16) fc/16 clock 409.6 s 1638 s 6554 s819.2 s 3277 s 13107 s 1638 s 6554 s 26214 s table 6-4 timer mode setting registers register name ta01mod ta1ffcr ta1ffis function timer mode pwm cycle upper timer input clock lower timer input clock timer f/f invert signal select 8-bit timer 2 channels 00 ? lower timer match t1, t16, t256 (00, 01, 10, 11) external clock t1 t4, t16 (00, 01, 10, 11) 0: lower timer output 1: upper timer output 16-bit timer mode 01 ? ? external clock t1, t4, t16 (00, 01, 10, 11) ? 8-bit ppg 1 channel 10 ? ? external clock t1, t4, t16 (00, 01, 10, 11) ? 8-bit pwm 1 channel 11 2 6 , 2 7 , 2 8 (01, 10, 11) ? external clock t1, t4, t16 (00, 01, 10, 11) ? 8-bit timer 1 channel 11 ? t1, t16, t256 (01, 10, 11) ? output disabled
page 121 2007-10-15 tmp91fw60 7. 16-bit timer/event counters (tmrb) the tmp91fw60 incorporates five multifunctional 16 -bit timer/event counters (tmrb0, tmrb1, tmrb2, tmrb3, tmrb4) which have the following operation modes: ? 16-bit interval timer mode ? 16-bit event counter mode ? 16-bit programmable pulse generation (ppg) output mode the capture function enables selection of the following modes: ? frequency measurement mode ? pulse width measurement mode ? time differential measurement figure 7-1 show block diagrams fo r tmrb0, tmrb1, tmrb2, tmrb3 and tmrb4. each timer/event counter channel consists of a 16-bit up-c ounter, two 16-bit timer registers (one of them with a double-buffer structure), two 16-bit capture registers, two comparators, a capture input controller, two timer flip- flops and a timer flip-flop controller. each timer/event counter is controlled by an 11-byte sfr (special-function register). each of the five channels (tmrb0, tmrb1, tm rb2, tmrb3, tmrb4) can be used independently. each chan- nel features the same operations except for those describe d in table 7-1. hence, only the operation of tmrb0 is explained below. table 7-1 registers and pins for tmrb channel tmrb0 tmrb1 tmrb2 tmrb3 tmrb4 specification external pins external clock/capture trigger input pins tb0in0 (also used as p80) tb1in0 (also used as p84) tb2in0 (also used as pa0) tb3in0 (also used as p30) tb4in0 (also used as pb0) tb0in1 (also used as p81) tb1in1 (also used as p85) tb2in1 (also used as pa1) tb3in1 (also used as p31) tb4in1 (also used as pb1) timer flip-flop output pins tb0out0 (also used as p82) tb1out0 (also used as p86) tb2out0 (also used as pa2) tb3out0 (also used as p32) tb4out0 (also used as pb2) tb0out1 (also used as p83) tb1out1 (also used as p87) tb2out1 (also used as pa3) tb3out1 (also used as p33) tb4out1 (also used as pb3) sfr (address) timer run register tb0run (0180h) tb1run (0190h) tb2run (01a0h) tb3run (01b0h) tb4run (01c0h) timer mode register tb0mod (0182h) tb1mod (0192h) tb2mod (01a2h) tb3mod (01b2h) tb4mod (01c2h) timer flip-flop control register tb0ffcr (0183h) tb1ffcr (0193h) tb2ffcr (01a3h) tb3ffcr (01b3h) tb4ffcr (01c3h) timer registers tb0rg0l (0188h) tb1rg0l (0198h) tb2rg0l (01a8h) tb3rg0l (01b8h) tb4rg0l (01c8h) tb0rg0h (0189h) tb1rg0h (0199h) tb2rg0h (01a9h) tb3rg0h (01b9h) tb4rg0h (01c9h) tb0rg1l (018ah) tb1rg1l (019ah) tb2rg1l (01aah) tb3rg1l (01bah) tb4rg1l (01cah) tb0rg1h (018bh) tb1rg1h (019bh) tb2rg1h (01abh) tb3rg1h (01bbh) tb4rg1h (01cbh) capture registers tb0cp0l (018ch) tb1cp0l (019ch) tb2cp0l (01ach) tb3cp0l (01bch) tb4cp0l (01cch) tb0cp0h (018dh) tb1cp0h (019dh) tb2cp0h (01adh) tb3cp0h (01bdh) tb4cp0h (01cdh) tb0cp1l (018eh) tb1cp1l (019eh) tb2cp1l (01aeh) tb3cp1l (01beh) tb4cp1l (01ceh) tb0cp1h (018fh) tb1cp1h (019fh) tb2cp1h (01afh) tb3cp1h (01bfh) tb4cp1h (01cfh)
page 122 2007-10-15 tmp91fw60 7.1 block diagrams figure 7-1 block diagrams of tmrb0 to tmrb4  timer flip-flop control  capture, external int input control 16-bit comparator (cpn1) 16-bit  timer register tbnrg1h/l 16-bit comparator (cpn0) capture register 0 tbncp0h/l 2 4 8 16 32 intx inty t t1 t t4 t t16 t t1 t t4 t t16 tazout tbnin0 tbnin1 run/ clear tbnrun tbnmod tbnrun tbnmod tbnmod tbnrun tbnmod inttbn0 inttbn1 tbnout1 capture register 1 tbncp1h/l 16-bit  timer register tbnrg0h/l  register buffer p tbnff0 tbnff1  16-bit up-counter (ucn) match detection timer n intx inty tazout internal data bus internal data bus int output timer flip-flop output tbnout0 overflow interrupt  inttbofn timer flip-flop match detection  prescaler clock: t t0 external int input (from tmra) selector count clock internal data bus internal data bus tmrb0 0 int5 int6 ta1out tmrb1 1 int7 int8 ta1out tmrb2 2 int1 int2 ta1out tmrb3 3 int3 int4 ta3out tmrb4 4 int9 int10 ta5out
page 123 2007-10-15 tmp91fw60 7.2 operation of each block 7.2.1 prescaler the 5-bit prescaler generates the source clock for tmrb0. the prescaler clock ( t0) is divided clock (divided by 4) from select ed clock by the register syscr0 of clock gear. this prescaler can be started or stopped using tb0run. counting starts when is set to 1; the prescaler is cleared to 0 and stops operation when is cleared to 0. table 7-2 show prescaler output clock resolution. note: xxx: don?t care 7.2.2 up counter (uc0) uc0 is a 16-bit binary counter which counts up according to input from the clock specified by tb0mod register. as the input clock, one of th e prescaler internal clocks t1, t4 and t16 or an external clock from tb0in0 pin can be selected. counting or stopping and clearing of the counter is controlled by timer operation control register tb0run. when clearing is enabled, the up co unter uc0 will be cleared to 0 each time its value matches the value in the timer register tb0rg1h/l. if cl earing is disabled, the counter operate s as a free-running counter. clearing can be enabled or disabled by using tb0mod. a timer overflow interrupt (inttbof0) is generated when uc0 overflow occurs. 7.2.3 timer registers (tb0rg0h/l, tb0rg1h/l) these two 16-bit registers are used to set the interval time. when the value in the up counter uc0 matches the value set in this timer register, the comparator match detect signal will go active. setting data for both upper and lower timer registers is needed. for example, using 2-byte data transfer instruction or using 1-byte data transfer instruction twic e for lower 8 bits and upper 8 bits in order. (the com- pare circuit will not operate if only the lower 8 bits are written. be sure to write to both timer registers (16 bits) from the lower 8 bits followed by the upper 8 bits.) the tb0rg0h/l timer register has a double-buffer struct ure, which is paired with register buffer 0. the value set in tb0run determines whether the do uble-buffer structure is en abled or disabled: it is disabled when = "0", and enabled when = "1". table 7-2 prescaler output clock resolution @fc = 20 mhz, fs = 32.768 khz system clock selectionsysc1< sysck> clock gear value syscr1 prescaler clock selection prescaler output clock resolution t1 (1/2) t4 (1/8) t16 (1/32) 1 (fs) xxx 0 (1/1) f fph 2 3 /fs (244 s) 2 5 /fs (977 s) 2 7 /fs (3.9 ms) 0 (fc) 000 (fc) 2 3 /fc (0.4 s) 2 5 /fc (1.6 s) 2 7 /fc(6.4 s) 001 (fc/2) 2 4 /fc (0.8 s) 2 6 /fc (3.2 s) 2 8 /fc (12.8 s) 010 (fc/4) 2 5 /fc (1.6 s) 2 7 /fc (6.4 s) 2 9 /fc (25.6 s) 011 (fc/8) 2 6 /fc (3.2 s) 2 8 /fc (12.8 s) 2 10 /fc (51.2 s) 100 (fc/16) 2 7 /fc (6.4 s) 2 9 /fc (25.6 s) 2 11 /fc (102.4 s) xxx 1 (1/16) fc/16 clock 2 7 /fc (6.4 s) 2 9 /fc (25.6 s) 2 11 /fc (102.4 s)
page 124 2007-10-15 tmp91fw60 when the double buffer is enabled, data is transferred from the register buffer 0 to the timer register when the values in the up counter (uc0) and the timer register tb0rg1h/l match. the double buffer circuit incorporates two flags to indicate whether or not data is written to the lower 8 bits and the upper 8 bits of the register buffer, respectively. only when both fl ags are set can data be transferred from the register buffer to the tim er register by a match between the up-counter uc0 and the timer register tb0rg1. this data transfer is performed so long as 16-bit da ta is written in the register buffer regardless of the register buffer to the timer register unexpectedly as explained below. for example, let us assume that an in terrupt occurs when only the lower 8 bits (l1) of the register buffer data (h1l1) have been written and the inte rrupt routine includes writes to all 16 bits in the register buffer and a transfer of the data to the timer register. in this case, if the higher 8 bits (h1) are written after the interrupt rou- tine is completed, only the flag for the higher 8 bits will be set, the flag for the lower 8 bits having been cleared in the interrupt routine. therefore, even if a match occurs between uc0 and tb0rg1 , no data transfer will be performed. then, in an attempt to set the next set of data (h2l2) in the register buffer, when the lower 8 bits (l2) are written, this will cause the flag for the lower 8 bits to be set as well as the flag for the higher 8 bits which has been set by writing the previous data (h1). if a matc h between uc0 and tb0rg1 occurs before the higher 8 bits (h2) are written, this will cause unexpected data (h1l2) to be sent to the timer register instead of the intended data (h2l2). to avoid such transfer timing problems due to interrupt s, the di instruction (disable interrupts) and the ei (enable interrupts) can be executed before and after setting data in the register buffer, respectively. after a reset, tb0rg0h/l and tb0rg1h/l are undefined. if the 16-bit timer is to be used after a reset, data should be written to it beforehand. on a reset is initialized to "0", disabling the double buffer. to use the double buffer, write data to the timer register, set to "1", then write data to the register buffer 10 as shown below. tb0rg0h/l and the register buffer 0 both have the same memory addresses (0188h and 0189h) allocated to them. if = "0", the value is written to both the timer register and the register buffer 0. if = "1", the value is writt en to the register buffer 0 only. the addresses of the timer registers are as follows: note:the timer registers are write- only registers and thus cannot be read. tmrb0 tb0rg0h/l tb0rg1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 000189h 000188h 00018bh 00018ah tmrb1 tb1rg0h/l tb1rg1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 000199h 000198h 00019bh 00019ah tmrb2 tb2rg0h/l tb2rg1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 0001a9h 0001a8h 0001abh 0001aah tmrb3 tb3rg0h/l tb3rg1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 0001b9h 0001b8h 0001bbh 0001bah tmrb4 tb4rg0h/l tb4rg1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 0001c9h 0001c8h 0001cbh 0001cah
page 125 2007-10-15 tmp91fw60 7.2.4 capture registers (tb0cp0h/l, tb0cp1h/l) these 16-bit registers are used to latc h the values in th e up counter (uc0). data in the capture registers should be read all 16 bits . for example, using a 2-byte data load instruction or two 1-byte data load instructions. the least significant byte is read first, followed by the most significant byte. (during capture is read, capture operati on is prohibited. in that case, the lowe r 8 bits should be read first, fol- lowed by the 8 bits.) the addresses of the capture registers are as follows; note:the capture registers are read-only registers and thus cannot be written to. 7.2.5 capture input control and external interrupt control this circuit controls the timing to latch the value of up-counter uc0 into tb0cp0h/l and tb0cp1h/l, and generates external interrupt.the latch timing of capture re gister and selection of edge for external interrupt is controlled by tb0mod. the value in the up-counter (uc0) can be loaded into a capture register by software. whenever 0 is written to tb0mod, the current valu e in the up counter (uc0) is load ed into capture register tb0cp0h/ l. it is necessary to keep the prescaler in run mode (e.g., tb0run must be held at a value of 1). tmrb0 tb0cp0h/l tb0cp1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 00 018d h00 018c h 00 018f h00 018e h tmrb1 tb1cp0h/l tb1cp1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 00 019d h00 019c h 00 019f h00 019e h tmrb2 tb2cp0h/l tb2cp1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 00 01ad h00 01ac h 00 01af h00 01ae h tmrb3 tb3cp0h/l tb3cp1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 00 01bd h00 01bc h 00 01bf h00 01be h tmrb4 tb4cp0h/l tb4cp1h/l upper 8 bits lower 8 bits upper 8 bits lower 8 bits 00 01cd h00 01cc h 00 01cf h00 01ce h
page 126 2007-10-15 tmp91fw60 7.2.6 comparators (cp00, cp01) cp10 and cp11 are 16-bit comparators which compare the value in the up counter uc0 with the value set in tb0rg0h/l or tb0rg1h/l respectively, in order to det ect a match. if a match is detected, the comparator generates an interrupt (inttb00 or inttb01 respectively) . 7.2.7 timer flip-flops (tb0ff0, tb0ff1) these flip-flops are inverted by the match detect si gnals from the comparators a nd the latch signals to the capture registers. inversion can be enabled and disabled for each element using tb0ffcr. after a reset the value of tb0ff0 is undefined. if "00" is written to tb0ffcr or , tb0ff0 will be inverted . if "01" is written to the capture registers, the value of tb0ff0 will be set to "1". if "10" is written to the capture registers, the value of tb0ff0 will be set to "0". note:if an inversion by the match-detect signal and a se tting change via the tb0ffcr register occurs simulta- neously, the resultant operation varies depending on the situation, as shown below. ? if an inversion by the match-detect si gnal and an inversion via the register oc cur simultaneously, the flip-flop will be inverted only once. ? if an inversion by the match-detect signal and an attempt to set the flip-flop to 1 via the register occur simultaneously, the flip-flop will be set to 1. ? if an inversion by the match-detect signal and an attempt to clear the flip-flop to 0 via the register occur simulta- neously, the flip-flop will be cleared to 0. if an inversion by match-detect signal and inversion disable setting occur simult aneously, two case (it is inverted and it is not inverted) are occurred. therefore, if changing inve rsion control (inversion enable/ disable), stop timer operation beforehand. the values of tb0ff0 and tb0ff1 can be output via th e timer output pins tb0out0 (which is shared with p82 and tb0out1 (which is shared with p83). timer output should be specified using the port p function reg- ister.
page 127 2007-10-15 tmp91fw60 7.3 sfr note: bits 1, 4 and 5 of tb0run/tb1run/tb2run/tb3run/tb4run are "1" when read. tmrb run register 76543210 tb0run (0180h) bit symbol tb0rde ? ? ? i2tb0 tb0prun ? tb0run read/write r/w r/w ? ? r/w r/w ? r/w after reset 0 0 0 0 ? 0 function double buffer 0: disable 1: enable always write 0. not in use idle2 0: stop 1: operate tmrb0 prescaler uc0 0: stop and clear 1: run (count up) tb1run (0190h) bit symbol tb1rde ? ? ? i2tb1 tb1prun ? tb1run read/write r/w r/w ? ? r/w r/w ? r/w after reset 0 0 0 0 ? 0 function double buffer 0: disable 1: enable always write 0. not in use idle2 0: stop 1: operate tmrb1 prescaler uc1 0: stop and clear 1: run (count up) tb2run (01a0h) bit symbol tb2rde ? ? ? i2tb2 tb2prun ? tb2run read/write r/w r/w ? ? r/w r/w ? r/w after reset 0 0 0 0 ? 0 function double buffer 0: disable 1: enable always write 0. not in use idle2 0: stop 1: operate tmrb2 prescaler uc2 0: stop and clear 1: run (count up) tb3run (01b0h) bit symbol tb3rde ? ? ? i2tb3 tb3prun ? tb3run read/write r/w r/w ? ? r/w r/w ? r/w after reset 0 0 0 0 ? 0 function double buffer 0: disable 1: enable always write 0. not in use idle2 0: stop 1: operate tmrb3 prescaler uc3 0: stop and clear 1: run (count up) tb4run (01c0h) bit symbol tb4rde ? ? ? i2tb4 tb4prun ? tb4run read/write r/w r/w ? ? r/w r/w ? r/w after reset 0 0 0 0 ? 0 function double buffer 0: disable 1: enable always write 0. not in use idle2 0: stop 1: operate tmrb4 prescaler uc4 0: stop and clear 1: run (count up) operation i2tb0, i2tb1, i2tb2, i2tb3, i2tb4: operation of idle2 mode 0 stop and clear tb0prun, tb1prun, tb2p run, tb3prun, tb4prun: operation of prescaler 1 count tb0run, tb1run, tb2 run, tb3run, tb4run: operation of tmrb
page 128 2007-10-15 tmp91fw60 tmrb mode register (read-modify-write instructions are prohibited.) (1/2) 76 5 4 3 210 tb0mod (0182h) bit symbol tb0ct1 tb0et1 tb0cp0i tb0cpm1 tb0cpm0 tb0cle tb0clk1 tb0clk0 read/write r/w w* r/w after reset 0 0 1 0 0 0 0 0 function tb0ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: undefined capture timing 00: disable int5 occurs at rising edge 01: tb0in0 tb0in1 int5 occurs at rising edge 10: tb0in0 tb0in0 int5 occurs at falling edge 11: ta1out ta1out int5 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb0 input clock select 00: tb0in0 pin input 01: t1 10: t4 11: t16 invert when uc0 is loaded into tb0cp1h/l invert when uc0 matches with tb0rg1h/l tb1mod (0192h) bit symbol tb1ct1 tb1et1 tb1cp0i tb1cpm1 tb1cpm0 tb1cle tb1clk1 tb1clk0 read/write r/w w* r/w after reset 0 0 1 0 0 0 0 0 function tb1ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: undefined capture timing 00: disable int7 occurs at rising edge 01: tb1in0 tb1in1 int7 occurs at rising edge 10: tb1in0 tb1in0 int7 occurs at falling edge 11: ta1out ta1out int7 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb1 input clock select 00: tb1in0 pin input 01: t1 10: t4 11: t16 invert when uc1 is loaded into tb1cp1h/l invert when uc1 matches with tb1rg1h/l tb2mod (01a2h) bit symbol tb2ct1 tb2et1 tb2cp0i tb2cpm1 tb2cpm0 tb2cle tb2clk1 tb2clk0 read/write r/w w* r/w after reset 0 0 1 0 0 0 0 0 function tb2ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: undefined capture timing 00: disable int1 occurs at rising edge 01: tb2in0 tb2in1 int1 occurs at rising edge 10: tb2in0 tb2in0 int1 occurs at falling edge 11: ta1out ta1out int1 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb2 input clock select 00: tb2in0 pin input 01: t1 10: t4 11: t16 invert when uc2 is loaded into tb2cp1h/l invert when uc2 matches with tb2rg1h/l tb3mod (01b2h) bit symbol tb3ct1 tb3et1 tb3cp0i tb3cpm1 tb3cpm0 tb3cle tb3clk1 tb3clk0 read/write r/w w* r/w after reset 0 0 1 0 0 0 0 0 function tb3ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: undefined capture timing 00: disable int3 occurs at rising edge 01: tb3in0 tb3in1 int3 occurs at rising edge 10: tb3in0 tb3in0 int3 occurs at falling edge 11: ta3out ta3out int3 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb3 input clock select 00: tb3in0 pin input 01: t1 10: t4 11: t16 invert when uc3 is loaded into tb3cp1h/l invert when uc3 matches with tb3rg1h/l
page 129 2007-10-15 tmp91fw60 note 1: n=0,1,2,3,4 note 2: z=1,3,5 note 3: as described above, whenever 0 is written to tbnmod, the current value in the up counter is loaded into cap- ture register tbncp0h/l. however, note that the current value in the up counter is also loaded into capture register tbncp0h/l when 1 is written to tbnmod while this bit is holding 0. tmrb mode register (read-modify-write instructions are prohibited.) (2/2) 76 5 4 3 210 tb4mod (01c2h) bit symbol tb4ct1 tb4et1 tb4cp0i tb4cpm1 tb4cpm0 tb4cle tb4clk1 tb4clk0 read/write r/w w* r/w after reset 0 0 1 0 0 0 0 0 function tb4ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: undefined capture timing 00: disable int9 occurs at rising edge 01: tb4in0 tb4in1 int9 occurs at rising edge 10: tb4in0 tb4in0 int9 occurs at falling edge 11: ta5out ta5out int9 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb4 input clock select 00: tb4in0 pin input 01: t1 10: t4 11: t16 invert when uc4 is loaded into tb4cp1h/l invert when uc4 matches with tb4rg1h/l tmrb source clock 00 external input clock (tbnin0 pin input) 01 t1 10 t4 11 t16 up counter clear control (ucn) 0 disable to clear up counter 1 clear by match with tbnrg1h/l capture/interrupt timing capture control int5 control 00 disable capture int generate at ris- ing edge of tbnin0 01 capture to tbncp0h/l at rising edge of tbnin0 capture to tbncp1h/l at rising edge of tbnin1 10 capture to tbncp0h/l at rising edge of tbnin0 capture to tbncp1h/l at falling edge of tbnin0 int generate at fall- ing edge of tbnin0 11 capture to tbncp0h/l at rising edge of tazout capture to tbncp1h/l at falling edge of tazout int generate at ris- ing edge of tbnin0 software capture 0 capture value of up counter to tbncp0h/l. 1 undefined (note 3)
page 130 2007-10-15 tmp91fw60 tmrb flip-flop control register (read-modify-w rite instructions are prohibited.) (1/2) 76543210 tb0ffcr (0183h) bit symbol tb0ff1c1 tb0ff1c0 tb0c1t1 tb0 c0t1 tb0e1t1 tb0e0t1 tb0ff0c1 tb0ff0c0 read/write w* r/w w* after reset11000011 function tb0ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb0ff0 inversion trigger 0: disable 1: enable tb0ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc0 is loaded into tb0cp1h/l. invert when uc0 is loaded into tb0cp0h/l. invert when uc0 matches tb0rg1h/l. invert when uc0 matches tb0rg0h/l. tb1ffcr (0193h) bit symbol tb1ff1c1 tb1ff1c0 tb1c1t1 tb1 c0t1 tb1e1t1 tb1e0t1 tb1ff0c1 tb1ff0c0 read/write w* r/w w* after reset11000011 function tb1ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb1ff0 inversion trigger 0: disable 1: enable tb1ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc1 is loaded into tb1cp1h/l. invert when uc1 is loaded into tb1cp0h/l. invert when uc1 matches tb1rg1h/l. invert when uc1 matches tb1rg0h/l. tb2ffcr (01a3h) bit symbol tb2ff1c1 tb2ff1c0 tb2c1t1 tb2 c0t1 tb2e1t1 tb2e0t1 tb2ff0c1 tb2ff0c0 read/write w* r/w w* after reset11000011 function tb2ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb2ff0 inversion trigger 0: disable 1: enable tb2ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc2 is loaded into tb2cp1h/l. invert when uc2 is loaded into tb2cp0h/l. invert when uc2 matches tb2rg1h/l. invert when uc2 matches tb2rg0h/l. tb3ffcr (01b3h) bit symbol tb3ff1c1 tb3ff1c0 tb3c1t1 tb3c0t1 tb3e1t1 tb3e0t1 tb3ff0c1 tb3ff0c0 read/write w* r/w w* after reset11000011 function tb3ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb3ff0 inversion trigger 0: disable 1: enable tb3ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc3 is loaded into tb3cp1h/l. invert when uc3 is loaded into tb3cp0h/l. invert when uc3 matches tb3rg1h/l. invert when uc3 matches tb3rg0h/l.
page 131 2007-10-15 tmp91fw60 note: n=0,1,2,3,4 tmrb flip-flop control register (read-modify-w rite instructions are prohibited.) (2/2) 76543210 tb4ffcr (01c3h) bit symbol tb4ff1c1 tb4ff1c0 tb4c1t1 tb4 c0t1 tb4e1t1 tb4e0t1 tb4ff0c1 tb4ff0c0 read/write w* r/w w* after reset11000011 function tb4ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb4ff0 inversion trigger 0: disable 1: enable tb4ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc4 is loaded into tb4cp1h/l. invert when uc4 is loaded into tb4cp0h/l. invert when uc4 matches tb4rg1h/l. invert when uc4 matches tb4rg0h/l. timer flip-flop (tbnff0) control 00 invert tbnff0. 01 set tbnff0 to 1. 10 clear tbnff0 to 0. 11 don?t care tbnff0 inversion when ucn matches tbnrg0h/l 0 disable trigger (disable inversion). 1 enable trigger (enable inversion). tbnff0 inversion when ucn matches tbnrg1h/l 0 disable trigger (disable inversion). 1 enable trigger (enable inversion). tbnff0 inversion when ucn is loaded into tbncp0h/l 0 disable trigger (disable inversion). 1 enable trigger (enable inversion). tbnff0 inversion when ucn is loaded into tbncp1h/l 0 disable trigger (disable inversion). 1 enable trigger (enable inversion). timer flip-flop (tbnff1) control 00 invert tbnff1. 01 set tbnff1 to 1. 10 clear tbnff1 to 0. 11 don?t care
page 132 2007-10-15 tmp91fw60 7.4 operation in each mode 7.4.1 16-bit interval timer mode generating interrupts at fixed intervals in this example the interrupt inttb01 is set to be generated at fixed intervals. the interval time is set in the timer register tb0rg1h/l. note:x: don't care, ?: no change 7.4.2 16-bit ev ent counter mode if the external clock (tb0in0 pin in put) is selected as the input clock in 16-bit timer mode, the timer can be used as an event counter. the up-counter counts up on the rising edge of tb0in0 input. to read the value of the counter, first perform software captu re once, then read the captured value. note 1: x: don't care, ?: no change note 2: when the timer is used as an event counter, set the prescaler to run mode (tb0run = 1). 76543210 tb0run 0 0 x x ? 0 x 0 stop tmrb0. intetb0 x 1 0 0 x 0 0 0 enable inttb01 and set it to interrupt level 4. disable inttb00. tb0ffcr 11000011disable trigger. tb0mod 001001* * select internal clock for input and disable the capture function. (**=01, 10, 11) tb0rg1 ********set interval time (16 bits). ******** tb0run 00xx?1x1start tmrb0. 6543210 tb0run 0 0 x x ? 0 x 0 stop tmrb0. p8cr ???????0set port to input mode. p8fc ???????1set port to input mode. intetb0 x 1 0 0 x 0 0 0 enable inttb01 and set interrupt level 4. disable inttb00. tb0ffcr 11000011disable trigger. tb0mod 0 0 1 0 0 1 0 0 select tb0in0 as the input clock. tb0rg1 ********set the number of counts (16 bits). ******** tb0run 00xx?1x1start tmrb0.
page 133 2007-10-15 tmp91fw60 7.4.3 16-bit programmable puls e generation (ppg) output mode square wave pulses can be generated at any frequency and duty ratio. the output pulse may be either active- low or active-high. in ppg mode a match between the value of the up-c ounter uc0 and either tim er register tb0rg0 or tb0rg1 inverts the output value for timer flip-flop tb0ff0. the tb0ff0 output value is output on tb0out0. in this mode the follow ing conditions must be satisfied. (value set in tb0rg0) < (value set in tb0rg1) figure 7-2 programmable pulse generati on (ppg) output waveforms when the tb0rg0 double buffer is enabled in this mode, the value of register buffer 0 will be shifted into tb0rg0 when the up-counter value matches tb0rg1. this feature facilitates the handling of low-duty waves. figure 7-3 operatio n of register buffer note:the values that can be set in tbxrgx range from 0001h to 0000h (equivalent to 10000h). if the maximum value 0000h is set, the match-detect signal goes active when the up-counter overflows. tb0out0 pin match with tb0rg0 (inttb00 interrupt) match with tb0rg1 (inttb01 interrupt) q 2 q 1 match with tb0rg1 tb0rg0 (value to be compared) q 3 q 2 register buffer shift into tb0rg1 write to tb0rg0 up-counter = q 1 up-counter = q 2 match with tb0rg0
page 134 2007-10-15 tmp91fw60 the following block diagram illustrates this mode. figure 7-4 block diagram of 16-bit ppg mode the following example shows how to set 16-bit ppg output mode: note:x: don?t care, ?: no change 76543210 tb0run 0 0 x x ? 0 x 0 disable the tb0rgh/l double buffer and stop tmrb0. tb0rg0 ********set the duty ratio. ********(16 bits) tb0rg1 ********set the fre quency. ********(16 bits) tb0run 10xx?0x0 enable the tb0rg0h/l double buffer. (the duty and frequency are changed on an inttb01 interrupt.) tb0ffcr 11001110 set the mode to invert tb0ff0 at the match with tb0rg0h/l, tb0rg1h/l. clear tb0ff0 to ?0?. tb0mod 001001* * select prescaler output as input clock and disable the capture func- tion. (**=01, 10, 11) p8cr ?????1?? set p82 to function as tb0out0. p8fc ?????1?? tb0run 10xx?1x1start tmrb0. 16 dkveqorctcvqt 4gikuvgtdwhhgt 0 16 dkveqorctcvqt tb0rg1h/l tb0run tb0rg0-wr 16-bit up counter (uc0) f/f (tb0ff0) tb0out0 (ppg qwvrwv ) tb0run tb0in0 t t1 t t4 t t16 tb0rg0h/l internal data bus selector selector match clear
page 135 2007-10-15 tmp91fw60 7.4.4 capture function examples used capture function, they can be ap plicable in many ways, for example: 1. one-shot pulse output from external trigger pulse 2. frequency measurement 3. pulse width measurement 4. time difference measurement 7.4.4.1 one-shot pulse output from external trigger pulse set the up counter uc0 in free-running mode with the internal input clock, input the external trigger pulse from tb0in0 pin, and load the value of up-c ounter into capture regist er tb0cp0h/l at the rise edge of the tb0in0 pin. when the interrupt int5 is generated at the rise edge of tb0in0 input, set the tb0cp0h/l value (c) plus a delay time (d) to tb0rg0h/l (= c + d), and set the above set value (c + d) plus a one-shot width (p) to tb0rg1h/l (= c + d + p). and, set ?11? to timer flip-flop control register tb0ffcr. set to trigger enable for be inverted timer flip-flop tb0ff0 by uc0 matching with tb0rg0h/l and with tb0rg1h/l. when interrupt inttb01 occurs, this inversion will be disabled after one-shot pulse is output. the (c), (d) and (p) correspond to c, d and p figure 7-5. figure 7-5 one-shot pu lse output (with delay) c p c + dc + d + p d count clock (prescaler output clock) timer output pin tb0out0 tb0in0 pin input (external trigger pulse) match with tb0rg0h/l match with tb0rg1h/l inversion enable inversion enable set the counter in free-running mode. load to capture register 0 (tb0cp0h/l) int5 occurred inttb01 occurred disables inversion caused by loading into tb0cp1h/l. pulse width delay time
page 136 2007-10-15 tmp91fw60 example: to output a 2-ms one-shot pulse with a 3-ms delay to the external trigger pulse to the tb0in0 pin. note: x: don't care, ?: no change when delay time is unnecessary, invert timer flip-flop tb0ff0 when up-counter value is loaded into capture register (tb0cp0h/l), and set the tb0cp0h/l value (c) plus the one-shot pulse width (p) to tb0rg1h/l when the interrupt int5 occurs. the tb0ff0 inversion should be enable when the up counter (uc10) value matches tb0rg1h/l, and disabled when generating the interrupt inttb01. figure 7-6 one-shot pulse out put (without delay) * clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph tb0mod xx101001 set free running. count with t1. load the up counter value into tb0cp0h/l at the rising edge of tb0in0 pin input. tb0ffcr xx000010clear tb0ff0 to 0. disable inversion of tb0ff0. p8cr ?????1?? set p82 to function as the tb0out0 pin. set p80 to tb0in0 input mode. p8fc ?????1?? inte56 x ? ? ? x 1 0 0 enable int5. intetb0 x 0 0 0 x 0 0 0 disable inttb00 and inttb01. tb0run ?0xx?1x1start tmrb0. tb0rg0 tb0cp0 + 3 ms/ t1 tb0rg1 tb0rg0 + 2 ms/ t1 tb0ffcr xx??11?? enable tb0ff0 inversion when the up counter value match with tb0rg0h/l or tb0rg1h/l. intetb0 x 1 0 0 x ? ? ? enable inttb01. tb0ffcr xx??00?? disable inversion of tb0ff0 when the up counter value match with value of tb0rg0h/l or tb0rg1h/l. intetb0 x 0 0 0 x ? ? ? disable inttb01. c p c + p count clock (prescaler output clock) timer output tb0out0 tb0in0 pin input (external trigger pulse) match with tb0rg1h/l inversion enable inttb01 occurred. enables inversion caused by loading into tb0cp0h/l. load into capture register 0 (tb0cp0h/l). int5 occurred. load the up counter value i n capture register 1 (tb0cp1 disable inversion caused by loading into tb0cp1h/l. pulse width
page 137 2007-10-15 tmp91fw60 7.4.4.2 frequency measurement the frequency of the external clock can be measur ed in this mode. the clock is input through the tb0in0 pin, and its frequency is measured by the 8-bit timers tmra01 and the 16-bit timer/event counter (tmrb0). (tmra01 is used to setting of measurement time by inversion ta1ff.) the tb0in0 pin input should be for the input clock of tmrb0. set to tb0mod = ?11?. the value of the up co unter (uc10) is loaded into the capture register tb0cp0h/l at the rise edge of the timer flip-flop ta1ff of 8-bit timers (t mra01), and into tb0cp1h/l at its fall edge. the frequency is calculated by difference between the loaded values in tb0cp0h/l and tb0cp1h/l when the interrupt (intta0 or intta1) is generates by either 8-bit timer. figure 7-7 fr equency measurement for example, if the value for the le vel 1 width of ta1ff of the 8-bit timer is set to 0.5 s and the differ- ence between the values in tb0cp0h/l and tb0cp1h/l is 100, the frequency is 100 0.5 s = 200 hz. note: the frequency in this exam ple is calculated with 50 duty. c1 c1 c1 c2 c2 c2 count clock (tb0in0 pin input) load to tb0cp1h/l ta1ff load to tb0cp0h/l intta0/intta1
page 138 2007-10-15 tmp91fw60 7.4.4.3 pulse width measurement this mode allows to measure the high-level width of an external pulse. while keeping the 16-bit timer/ event counter counting (free running) with the internal clock input, external pulse is input through the tb0in0 pin. then the capture function is used to load the uc0 values into tb0cp0h/l and tb0cp1h/l at the rising edge and fal ling edge of the external trigger pulse re spectively. the interr upt int5 occurs at the falling edge of tb0in0. the pulse width is obtained from the difference between the values of tb0cp0h/l and tb0cp1h/l and the internal clock cycle. for example, if the internal clock is 0.8 s and the difference between tb0cp0h/l and tb0cp1h/l is 100, the pulse width will be 100 0.8 s = 80 s. additionally, the pulse width which is over the uc0 maximum count time specified by the clock source, can be measured by changing software. figure 7-8 pulse width measurement note: only in this pulse width measuring mode (tb0mo d = 10), external interrupt int5 occurs at the falling edge of tb0in0 pin input. in other modes, it occurs at the rising edge. the width of low-level can be meas ured from the difference between th e first c2 and the second c1 at the second int5 interrupt. c1 c1 c1 c2 c2 c2 count clock (prescaler output clock) load to tb0cp1h/l tb0in0 pin input (external pulse) load to tb0cp0h/l int5
page 139 2007-10-15 tmp91fw60 7.4.4.4 time difference measurement this mode is used to measure the difference in time between the risi ng edges of external pulses input through tb0in0 and tb0in1. keep the 16-bit timer/event counte r (tmrb0) counting (free running) with the internal clock, and load the uc0 value into tb0cp0h/l at the rising edge of the input pulse to tb0in0. then the interrupt int5 is generated. similarly, the uc0 value is loaded into tb0cp1h/l at the rising edge of the input pulse to tb0in1, generating the interrupt int6. the time difference between these pulses can be obtained by multiplying the value subtracted tb0cp0h/l from tb0cp1h/l and the internal clock cycle together at which loading the up counter value into tb0cp0h/l and tb0cp1h/l has been done. figure 7-9 time difference measurement c1 c2 count clock (prescaler output clock) load to tb0cp1h/l tb0in0 pin input tb0in1 pin input load to tb0cp0h/l int5 int6 time difference
page 140 2007-10-15 tmp91fw60 8. serial channels (sio) tmp91fw60 includes 3 serial i/o channels. for both channels either uart mode (asynchronous transmission) or i/o interface mode (synchronous transmission) can be selected. 1. i/o interface mode ? mode 0: for transmitting and recei ving i/o data using the synchroni zing signal sclk for extending i/o. 2. uart mode ? mode 1: 7-bit data ? mode 1: 8-bit data ? mode 1: 9-bit data in mode 1 and mode 2, a parity bit can be added. mode 3 has a wakeup function for the master controller to start slave controllers via a serial li nk (a multi-controller system). figure 8-2 are block diagrams for each channel. sio is compounded mainly prescaler, serial clock generati on circuit, receiving buffer and control circuit, transmis- sion buffer and control circuit. both channels operate in the same function except for th e following points; hence only the operation of channel 0 is explained below. figure 8-1 data formats table 8-1 differences in se rial channel specifications sio0 sio1 sio2 pin name txd0 (p90) rxd0 (p91) cts0 /sclk0 (p92) txd1 (p93) rxd1 (p94) cts1 /sclk1 (p95) txd2 (p41) rxd2 (p42) cts 2 /sclk2 (p43) stop stop 1 bit 0 2 3 4 5 6 start bit 0 1 2 3 4 5 6 start bit 0 1 2 3 4 5 6 parity start bit 0 1 2 3 4 5 6 start bit 0 1 2 3 4 5 6 7 7 parity stop stop stop start bit 0 1 2 3 4 5 6 start bit 0 1 2 3 4 5 6 7 bit 8 7 8 stop 7 h  mode 0 (i/o interface mode h  mode 1 (7-bit uart mode) transfer direction no parity parity h mode 2 (8-bit uart mode) no parity wakeup function h  mode 3 (9-bit uart mode when bit8 = 1, address (select code) is denoted. when bit8 = 0, data is denoted. parity
page 141 2007-10-15 tmp91fw60 8.1 block diagrams figure 8-2 block diagram of the serial channel 0/1/2 0qvgp
5+15+15+1 transmission counter (uart only ? 16) receive counter (uart only ? 16) serial channel interrupt control transmission control selector prescaler selector selector selector 248163264 t t0 f sys t t0 t t2 t t8 t t32 t t2 t t8 t t32 serial clock generation circuit baud date generator brncr ta0trg (from tmra0) brncr sc0cr sioclk scnmod0 scnmod0 txdclk scncr scnmod0 scnmod0 scnmod0 brncr brnadd prescaler uart mode sclkn sclkn rxdn txdn intrxn inttxn ? 2 error flag parity control rb8  receive buffer 1 (shift register) receive buffer 2 (scnbuf) tb8 transmission buffer (scnbuf) scncr i/o interface mode i/o interface mode receive control ctsn int request internal data bus rxdclk
page 142 2007-10-15 tmp91fw60 8.2 operation of each circuit 8.2.1 prescaler a 6-bit prescaler generates an operatio n clock for sio0. the prescaler is act eve only when a baud rate gener- ator is specified as a serial transfer clock. as an input clock of the prescaler, be sure to set syscr0 to ?0? and then specify f fph . this clock is used for t0 with being divided by 4. table 8-2 shows prescaler clock resolution into the baud rate generator. the baud rate generator selects between 4 clock inputs: t0, t2, t8, and t32 among the prescaler out- puts. 8.2.2 baud rate generator the baud rate generator is a circuit which generates transmission and receiving clocks which determine the transmission rate of the serial channels. the input clock to the baud rate generator, t0, t2, t8 or t32, is generated by the 6-bit prescaler which is shared by the timers. one of thes e input clocks is selected using the br0cr field in the baud rate generator control register. the baud rate generator includes a frequency divider, which divides the frequency by 1, n + (16 ? k)/16 or 16 values, determining the transmission rate. the tr ansmission rate is determined by the settings of br0cr and br0add. table 8-2 prescaler clock resolution to baud rate generator select system clock gear value select prescaler clock prescaler output clock resolution t0 t2 t8 t32 1 (fs) xxx 0 (1/1) f fph 2 2 /fs 2 4 /fs 2 6 /fs 2 8 /fs 0 (fc) 000 (fc) 2 2 /fc 2 4 /fc 2 6 /fc 2 8 /fc 001 (fc/2) 2 3 /fc 2 5 /fc 2 7 /fc 2 9 /fc 010 (fc/4) 2 4 /fc 2 6 /fc 2 8 /fc 2 10 /fc 011 (fc/8) 2 5 /fc 2 7 /fc 2 9 /fc 2 11 /fc 100 (fc/16) 2 6 /fc 2 8 /fc 2 10 /fc 2 12 /fc
page 143 2007-10-15 tmp91fw60 8.2.2.1 in uart mode (1) when br0cr = 0 the settings br0add are ignored. the baud rate generator divides the selected prescaler clock by n, which is set in br0ck. (n = 1, 2, 3 ... 16) (2) when br0cr = 1 the n + (16 ? k)/16 division function is enabled. the baud rate generator divides the selected prescaler clock by n + (16 ? k)/16 using the value of n set in br0cr (n = 2, 3 ... 15) and the value of k set in br0add (k = 1, 2, 3 ... 15) note: if n = 1 and n = 16, the n + (16 ? k)/16 division function is di sabled. set br0cr to ?0?. 8.2.2.2 in i/o interface mode the n + (16 ? k)/16 division fu nction is not available in i/o interface mode. se t br0cr to ?0? before dividing by n. the method for calculating the transm ission rate when the baud rate generator is used is explained below. (1) in uart mode (2) in i/o interface mode 8.2.2.3 integer divider (n divider) for example, when the source clock frequency (f c) =19.6608 mhz, the input clock frequency = t2 (fc/ 16), the frequency divider n ( br0cr) = 8, and br0cr = 0, the baud rate in uart mode is as follows: = 19.6608 10 6 16 8 16 = 9600 (bps) note: the + (16 - k)/16 division function is disabled and setting br0add is invalid . *clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph baud rate input clock of baud rate generator frequency divider for baud rate generator --------------------------------------------------------------------------------------------------- - 16 = baud rate input clock of baud rate generator frequency divider for baud rate generator --------------------------------------------------------------------------------------------------- - 2 = baudrate fc 16 ? 8 -------------- 16 =
page 144 2007-10-15 tmp91fw60 8.2.2.4 n + (16 - k)/16 divider (uart mode only) accordingly, when the source clock frequency (fc) = 15.9744 mhz, the input clock frequency = t2, the frequency divider n (br0cr) = 6, k (br0add) = 8, and br0cr = 1, the baud rate in uart mode is as follows: table 8-3 show examples of uart mode transfer rates. additionally, the external clock inpu t is available in the serial clock. the method for calculating the baud rate is explained below: ? in uart mode baud rate = external clock input frequency 16 it is necessary to satisfy (external clock input cycle) 4/f sys ? in i/o interface mode baud rate = external clock input frequency it is necessary to satisfy (external clock input cycle) 16/f sys note: transmission rates in i/o interface mode ar e eight times faster than the values given above. *clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph table 8-3 uart baud rate selection (when baud rate generator is used and br0cr=0, syscr0=0) unit (kbps) fc [mhz] input clock t0 (fc/4) t2 (fc/16) t8 (fc/64) t32 (fc/256) frequency divider n 7.3728 1 115.200 28.800 7.200 1.800 3 38.400 9.600 2.400 0.600 6 19.200 4.800 1.200 0.300 a 11.520 2.880 0.720 0.180 c 9.600 2.400 0.600 0.150 f 7.680 1.920 0.480 0.120 9.8304 1 153.600 38.400 9.600 2.400 2 76.800 19.200 4.800 1.200 4 38.400 9.600 2.400 0.600 5 30.720 7.680 1.920 0.480 8 19.200 4.800 1.200 0.300 10 9.600 2.400 0.600 0.150 baudrate= fc/16 6 16 8 ? () 16 ------------------- + ----------------------------- 16 ?? ?? ?? ?? 15.9744 10 6 16 6 8 16 ----- - + ?? ?? 16 = 9600(bps) =
page 145 2007-10-15 tmp91fw60 timer out clock (ta0trg) can be used for source clock of uart mode only. calculation method the frequency of ta0trg frequency of ta0trg = baud rate 16 note: in case of i/o interface mode, pr ohibit to use ta0trg for source clock. 8.2.3 serial clock generation circuit this circuit generates the basic clock for transmission and receiving data. 8.2.3.1 in i/o interface mode in sclk output mode with the setting sc0cr = ?0?, the basic clock is generated by dividing the output of the baud rate generato r by 2, as described previously. in sclk input mode with the setting sc0cr = ?1?, the rising edge or falling edge will be detected according to the setting of the sc0cr register to generate the basic clock. 8.2.3.2 in uart mode the sc0mod0 setting determines whether the baud rate generator clock, the internal system clock f sys , the match detect signal from timer tmra0 or th e external clock (sclk0) is used to generate the basic clock sioclk. 8.2.4 receiving counter the receiving counter is a 4-bit bina ry counter used in uart mode which counts up the pu lses of the sio- clk clock. it takes 16 sioclk pulses to receive 1 bit of data; each data bit is sampled three times ? on the 7th, 8th and 9th clock cycles. the value of the data bit is determined from these three samples using the majority rule. for example, if the data bit is samp led respectively as ?1?, ?0? and ?1? on 7th, 8th and 9th clock cycles, the received data bit is taken to be ?1?. a data bit sampled as ?0?, ?0? and ?1? is taken to be ?0?. 8.2.5 receiving control 8.2.5.1 in i/o interface mode in sclk output mode with the setting sc0cr = ?0?, the rxd0 signal is sampled on the rising or falling edge of the shift clock which is output on the sclk0 pin, according to the sc0cr setting. in sclk input mode with the setting sc0cr = ?1?, the rxd0 signal is sampled on the rising or falling edge of the sclk0 input, acco rding to the sc0cr setting. 8.2.5.2 in uart mode the receiving control block has a circuit which detect s a start bit using the majority rule. received bits are sampled three times; when two or more out of thr ee samples are ?0?, the bit is recognized as the start bit and the receiving operation commences. the values of the data bits that are received are also determined using the majority rule.
page 146 2007-10-15 tmp91fw60 8.2.6 receiving buffers to prevent overrun erro rs, the receiving buffers are arranged in a d ouble-buffer structure. received data is stored one bit at a time in r eceiving buffer 1 (which is a shift register). when 7 or 8 bits of data have been stored in receiving buffer 1, the stored data is transmitted to receiving buffer 2 (sc0buf); this causes an in trx0 interrupt to be generated. the cpu only reads receiving buffer 2 (sc0buf). even before the cpu reads receiving buffer 2 (sc0buf), the recei ved data can be stored in receiv- ing buffer 1. however, unless receiving buffer 2 (sc0buf) is read before a ll bits of the next data are received by receiving buffer 1, an overrun error occurs. if an overrun er ror occurs, the contents of receiving buffer 1 will be lost, although the conten ts of receiving buffer 2 a nd sc0cr will be preserved. sc0cr is used to store either the parity bit ? added in 8-bit uart mode ? or the most significant bit (msb) ? in 9-bit uart mode. in 9-bit uart mode the wakeup function for the slave controller is enabled by setting sc0mod0 to ?1?; in this mode intrx0 interrupts occur only when the value of sc0cr is ?1?. note 1: the double buffer structure does not support sc0cr. note 2: if the cpu reads receive buffer 2 while data is bei ng transferred from receive buffer 1 to receive buffer 2, the data may not be read properly. to avoid this situat ion, a read of receive buffer 2 should be triggered by a receive interrupt. 8.2.7 transmission counter the transmission counter is a 4-bit binary counter which is used in ua rt mode and which, like the receiv- ing counter, counts the sioclk clock pulses; a txdclk pulse is generated every 16 sioclk clock pulses. figure 8-3 generation of the transmission clock 8.2.8 transmission controller 8.2.8.1 in i/o interface mode in sclk output mode with the setting sc0cr = ?0?, the data in the transmission buffer is output one bit at a time to the txd0 pin on the rising or falling edge of the shift clock which is output on the sclk0 pin, according to the sc0cr setting. in sclk input mode with the setting sc0cr = ?1?, the data in the transmission buffer is output one bit at a time on the txd0 pin on the rising or falling edge of the sclk0 input, according to the sc0cr setting. 8.2.8.2 in uart mode when transmission data sent from the cpu is written to the transmission buffer, transmission starts on the rising edge of the next txdclk. sioclk txdclk 15161234567891011121314151612
page 147 2007-10-15 tmp91fw60 8.2.8.3 handshake function use of cts0 pin allows data can be sent in units of one frame; thus, overrun erro rs can be avoided. the handshake function is enabled or disabled by the sc0mod0 setting. when the cts0 pin goes high on completion of the current da ta send, data transmission is halted until the cts0 pin goes low again. however, the inttx0 interrup t is generated, it requests the next data send to the cpu. the next data is written in the tr ansmission buffer and data transmission is halted. though there is no rts pin, a handshake function can be easily configured by setting any port assigned to be the rts function. the rts should be output ?high? to request send data halt after data receive is completed by software in the rxd interrupt routine. figure 8-4 handshake function note 1: if the cts0 signal goes high during transmission, no more data will be sent after completion of the current transmission. note 2: transmission starts on the first falling edge of the txdclk clock after the cts0 signal has fallen. figure 8-5 cts0 (clear to send) timing txd cts0 rxd rts (any port) 6/2(9 6/2(9 sender receiver start bit bit 0 txd sioclk txdclk cts0 13 14 15 16 1 2 3 13 14 15 16 1 2 3 a b transmission is suspended during this period timing to write to the transmission buffer
page 148 2007-10-15 tmp91fw60 8.2.9 transmission buffer the transmission buffer (sc0buf) sh ifts out and sends the transmission data written from the cpu from the least significant bit (lsb) in order. when all the bits are shifted out, the transmission buffer becomes empty and generates an inttx0 interrupt. 8.2.10 parity control circuit when sc0cr in the serial channe l control register is set to ?1?, it is possible to transmit and receive data with parity. however, parity can be added only in 7-bit uart mode or 8-bit uart mode. the sc0cr field in the serial channe l control register allows either ev en or odd parity to be selected. in the case of transmission, parity is automatically gene rated when data is written to the transmission buffer sc0buf. the data is transmitted after the parity bit ha s been stored in sc0buf in 7-bit uart mode or in sc0mod0 in 8-bit uart mode. sc0cr and sc0cr must be set before the trans- mission data is written to the transmission buffer. in the case of receiving, data is shifte d into receiving buffer 1, and the pa rity is added after the data has been transmitted to receiving buffer 2 (sc0buf), and then compared with sc0buf in 7-bit uart mode or with sc0cr in 8-bit uart mode. if they are not equal, a parity error is generated and the sc0cr flag is set. 8.2.11 error flags three error flags are prov ided to increase the reli ability of data reception. 8.2.11.1 overrun error if all the bits of the next data item have been received in receiving buffer 1 while valid data still remains stored in receiving buffer 2 (sc0buf) , an overrun error is generated. the below is a recommended flow when the overrun error is generated. (intrx interrupt routine) 1. read receiving buffer 2. read error flag 3. if = 1 then a. set to disable receiving (w rite ?0? to sc0mod0) b. wait to termin ate current frame c. read receiving buffer d. read error flag e. set to enable receiving (write ?1? to sc0mod0) f. request to transmit again 4. other note: overrun errors are generated only with regard to receive buffer 2 (sc0buf). thus, if sc0cr is not read, no overrun error will occur.
page 149 2007-10-15 tmp91fw60 8.2.11.2 parity error the parity generated for the data sh ifted into receiving buffer 2 (sc0 buf) is compared with the parity bit received via the rxd pin. if they are not equal, a parity error is generated. note: the parity error flag is cleared every time it is r ead. however, if a parity error is detected twice in suc- cession and the parity error flag is read between the tw o parity errors, it may seem as if the flag had not been cleared. to avoid this situation, a read of t he parity error flag should be triggered by a receive interrupt. 8.2.11.3 framing error the stop bit for the received data is sampled three ti mes around the center. if th e majority of the samples are ?0?, a framing error is generated. 8.2.12 timing generation 8.2.12.1 in uart mode note 1: in 9 bits and 8 bits + parity mode, interrupts coincide with the ninth bit pulse. thus, when servicing the interrupt, it is nec- essary to wait for a 1-bit period (to allow the stop bit to be transferred) to allow checking for a framing error. note 2: the higher the transfer rate, the later than the middle receive interrupts and errors occur. 8.2.12.2 i/o interface table 8-4 receiving mode 9 bits 8 bits + parity 8 bits, 7 bits + parity, 7 bits interrupt timing center of last bit (bit8) center of last bit (parity bit) center of stop bit framing error timing center of stop bit center of stop bit center of stop bit parity error timing ? center of last bit (parity bit) center of stop bit overrun error timing center of last bit (bit8) center of last bit (parity bit) center of stop bit table 8-5 transmitting mode 9 bits 8 bits + parity 8 bits, 7 bits + parity, 7 bits interrupt timing just before stop bit is trans- mitted just before stop bit is transmitted just before stop bit is transmitted transmission interrupt timing sclk output mode immediately after the last bit. (see figure 8-8) sclk input mode immediately after rise of last sclk signal rising mode, or immediately after fall in falling mode. (see figure 8-9) receiving interrupt timing sclk output mode timing used to transmit received data to receive buffer 2 (sc0buf) (e.g., immediately after last sclk). (see figure 8-10) sclk input mode timing used to transmit received data to receive buffer 2 (sc0buf) (e.g., immediately after last sclk). (see figure 8-11)
page 150 2007-10-15 tmp91fw60 8.3 sfr serial control register (read-modify-write instructions are prohibited.) 76543210 sc0cr (0201h) sc1cr (0209h) sc2cr (0211h) bit symbol rb8 even pe oerr perr ferr sclks ioc read/write r r/w r (cleared to "0" when read) r/w after resetundefined0000000 function received data bit8 parity 0: odd 1: even parity addi- tion 0: disable 1: enable overrun error flag 0: undetect error 1: detect error parity error flag 0: undetect error 1: detect error framing error flag 0: undetect error 1: detect error edge selec- tion for sclk pin (i/ o mode) 0: sclk 1: sclk i/o interface input clock selection 0: baud rate generator 1: sclk pin input note1: as all error flags are cleared after reading, do not test only a single bit with a bit-testing instruction. note2: a baud rate generator scncr = "0" is unavailable as an input clock for an i/o interface if a prescaler clock is set to fc/16 whensyscr0 is "1". note3: n =0, 1, 2. serial mode control register 0 76543210 sc0mod0 (0202h) sc1mod0 (020ah) sc2mod0 (0212h) bit symbol tb8 ctse rxe wu sm1 sm0 sc1 sc0 read/write r/w after reset00000000 function transmis- sion data bit8 handshake function 0: disable 1: enable receive function 0: disable 1: enable wakeup function 0: disable 1: enable serial transmission mode 00: i/o interface mode 01: 7-bit uart mode 10: 8-bit uart mode 11: 9-bit uart mode serial transmission clock (uart) 00: timer ta0trg 01: baud rate generator 10: internal clock f sys 11: external clock (sclk input) note1: sclkpin and cts pin sclk pin cts pin sio0 sclk0 cts0 sio1 sclk1 cts1 sio2 sclk2 cts2 note2: a baud rate generator scnmod0 = "01" is unavai lable as a serial transfer clock if a prescaler clock is set to fc/16 whensyscr0 is "1". note3: n =0, 1, 2. serial mode control register 1 76543210 sc0mod1 (0205h) sc1mod1 (020dh) sc2mod1 (0215h) bit symboli2s0fdpx0?????? read/write r/w r/w ?????? after reset00?????? bit symboli2s1fdpx1?????? read/write r/w r/w ?????? after reset00?????? bit symboli2s2fdpx2?????? read/write r/w r/w ?????? after reset00?????? function idle2 0: stop 1: run duplex 0: half 1: full
page 151 2007-10-15 tmp91fw60 baud rate generator control 76543210 br0cr (0203h) bit symbol ? br0adde br0ck1 br0ck0 br0s3 br0s2 br0s1 br0s0 read/write r/w after reset00000000 br1cr (020bh) bit symbol ? br1adde br1ck1 br1ck0 br1s3 br1s2 br1s1 br1s0 read/write r/w after reset00000000 br2cr (0213h) bit symbol ? br2adde br2ck1 br2ck0 br2s3 br2s2 br2s1 br2s0 read/write r/w after reset00000000 function always write ?0?. + (16 - k)/16 division 0: disable 1: enable input clock selection for baud rate generator 00: t0 01: t2 10: t8 11: t32 setting of the divided frequency ?n? 76543210 br0add (0204h) bit symbol ? ? ? ? br0k3 br0k2 br0k1 br0k0 read/write ? ? ? ? r/w after reset????0000 br1add (020ch) bit symbol ? ? ? ? br1k3 br1k2 br1k1 br1k0 read/write ? ? ? ? r/w after reset????0000 br2add (0214h) bit symbol ? ? ? ? br2k3 br2k2 br2k1 br2k0 read/write ? ? ? ? r/w after reset????0000 function sets frequency divisor ?k? (divided by n + (16 - k)/16) baud rate generator frequency divisor setting brncr = 1 brncr = 0 brncr 0000(n=16) or 0001(n=1) 0010(n=2) to 1111(n=15) 0001(n=1)uart only to 1111(n=15) 0000(n=16) brnadd 0000 disable disable divided by n 0001 (k = 1) disable divided by n + (16 - k)/ 16 to 1111 (k = 15) note: availability of +(16 - k)/16 division function n uart mode i/o mode the baud rate generator can be set ?1? in uart mode and disable + (16 - k)/16 division function. don?t use in i/o interface mode. 2 to 15 o x 1, 16 x x note: set br1cr to 1 after setting k (k = 1 to 15) to br1add when n+ (16 - k)/16 division function is used. note: n = 0,1,2
page 152 2007-10-15 tmp91fw60 8.4 operation in each mode 8.4.1 mode 0 (i/o interface mode) this mode allows an increase in the number of i/o pi ns available for transmittin g data to or receiving data from an external shift register. this mode includes the sclk output mode to output synchronous clock sclk and sclk input mode to input external synchronous clock sclk. figure 8-6 sclk output mode connection example figure 8-7 sclk inpu t mode connection example serial transmission/receiving buffer registers (read-modify-write instructions are prohibited.) 76543210 sc0buf (0200h) sc1buf (0208h) sc2buf (0210h) tb7 tb6 tb5 tb4 tb3 tb2 tb1 tb0 (transmission) 76543210 rb7 rb6 rb5 rb4 rb3 rb2 rb1 rb0 (receiving) txd sclk port shift register  a b si c d sck e f rck g h rxd sclk port shift register  a  b qh c d clock e f s/l g h 6/2(9 6/2(9 output extension tc74hc595 or equivalent input extension tc74hc165 or equivalent txd sclk port rxd sclk port 6/2(9 6/2(9 output extension tc74hc595 or equivalent shift register a b si c d sck e f rck g h external clock input extension external clock tc74hc165 or equivalent shift register a b qh c d clock e f s/l g h
page 153 2007-10-15 tmp91fw60 8.4.1.1 transmission in sclk output mode 8-bit data and a synchronous clock are output on the txd0 and sclk0 pins respectively each time the cpu writes the data to the transmission buffer. when all data is output, intes0 will be set to generate the inttx0 interrupt. figure 8-8 transmitting operation in i/o interfac e mode (sclk output mode) in sclk input mode, 8-bit data is output on the txd0 pin when the sclk0 input becomes active after the data has been written to the transmission buff er by the cpu. when all data is output, intes0 will be set to generate inttx0 interrupt. figure 8-9 transmitting operation in i/o interfac e mode (sclk input mode) bit 0 bit 1 bit 6 bit 7 txd0 itx0c (inttx0 interrupt request) timing to write transmission data sclk0 output ( = 0: rising edge mode) sclk0 output ( = 1: falling edge mode) (internal clock timing) bit 0 bit 1 bit 5 bit 6 bit 7 sclk0 input ( = 1: falling edge mode) sclk0 input ( = 0: rising edge mode) txd0 itx0c (inttx0 interrupt request)
page 154 2007-10-15 tmp91fw60 8.4.1.2 receiving in sclk output mode, the synchronous clock is ou tputted from sclk0 pin and the data is shifted to receiving buffer 1. this starts when the receive in terrupt flag intes0 is cleared by reading the received data. when 8-bit data are received, the data will be transmitted to receiving buffer 2 (sc0buf according to the timi ng shown below) and intes0 will be set to generate intrx0 interrupt. the outputting for the first sclk0 starts by setting sc0mod0 to ?1?. figure 8-10 receiving op eration in i/o interfac e mode (sclk output mode) in sclk input mode, the data is shifted to receiving buffer 1 when th e sclk input becomes active after the receive interrupt flag intes0 is cleared by reading the received data. when 8-bit data is received, the data will be shifted to receiving bu ffer 2 (sc0buf according to the timing shown below) and intes0 will be set again to be generate intrx0 interrupt. figure 8-11 receiving op eration in i/o interfac e mode (sclk input mode) note: the system must be put in the receive enable state (sc0mod0 = 1) before data can be received. bit 0 bit 1 bit 6 bit 7 sclk0 output ( = 0: rising edge mode) sclk0 output ( = 1: falling edge mode) rxd0 irx0c (intrx0 interrupt request) bit 0 bit 1 bit 5 bit 6 bit 7 sclk0 input ( = 1: falling edge mode) sclk0 input ( = 0: rising edge mode) rxd1 irx0c (intrx0 interrupt request)
page 155 2007-10-15 tmp91fw60 8.4.1.3 transmission and receiving (full duplex mode) when the full duplex mode is used, set the level of r eceive interrupt to ?0? and set enable the interrupt level (1 to 6) to the transmission interrupt. in the transmission inte rrupt program, the receiving operation should be done like the above example before setting the next transmission data. example: channel 0, sclk output baud rate = 9600 bps fc = 14.7456 mhz note: x: don't care, ?: no change, *: data *clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: f fph port setting 76543210 intes0 x0010000set the inttx0 level to 1. set the intrx0 level to 0. sc0mod0 ????00??select i/o interface mode. sc0mod1 ? 1xxxxxxselect full duplex m ode. sc0cr ??????00sclk0 output mode, transmit on falling edge mode, receive on rising edge mode. br0cr 00110011b aud rate = 9600 bps sc0mod0 ??1?????e nable receiving sc0buf ********set the transmit data and start. 76543210 acc sc0buf read the receiving buffer. sc0buf ********set the next transmission data.
page 156 2007-10-15 tmp91fw60 8.4.2 mode 1 (7-bit uart mode) 7-bit uart mode is selected by setting serial channel mode register sc0mod0 to ?01?. in this mode, a parity bit can be added. use of a parity bit is enabled or disabled by the setting of the serial channel control register sc0cr bit; whether even parity or odd parity will be used is determined by the sc0cr setting when sc0cr is set to ?1? (enabled). example: when transmission data of the following format, the control registers should be set as described below. this explanation applies to channel 0. figure 8-12 7-bit uart mode note:x: don't care, ?: no change, *: data *clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: system clock 76543210 sc0mod0 ????0101select 7-bit uart mode. sc0cr ? 1 1 ? ? ? ? ? add even parity. br0cr 0 0 1 0 0 1 0 1 set the transmission rate to 2400 bps. intes0 x 1 0 0 ? ? ? ? enable the inttx0 interrupt and set it to interrupt level 4. sc0buf ********set data for transmission. stop start bit 0 1 2 3 4 5 6 even parity transmission direction (transmission rate: 2400 bps at fc = 12.288 mhz)
page 157 2007-10-15 tmp91fw60 8.4.3 mode 2 (8-bit uart mode) 8-bit uart mode is selected by setting sc0mod0 to ?10?. in this mode, a parity bit can be added (use of a parity bit is enabled or disabled by the setting of sc0cr); whether even parity or odd parity will be used is determined by the sc0cr setting when sc0cr is set to ?1? (enabled). example: when receiving data of the following form at, the control registers should be set as described below. figure 8-13 8-bit uart mode note:x: don't care, ?: no change *clock state system clock: high frequency (fc) clock gear: 1 (fc) prescaler clock: system clock 76543210 sc0mod0 ??1?1001e nable receiving in 8-bit uart mode. sc0cr ?01?????add odd parity. br0cr 00010101set the transmission rate to 9600 bps. intes0 ????x100e nable the inttx0 interrupt and set it to interrupt level 4. acc sc0cr and 00011100 if acc 0 then error acc sc0buf check for errors. read the received data. stop start bit 0 1 2 3 4 5 6 7 odd parity transmission direction (transmission rate: 9600 bps at fc = 12.288 mhz)
page 158 2007-10-15 tmp91fw60 8.4.4 mode 3 (9-bit uart mode) 9-bit uart mode is selected by setting sc0mod0 to ?11?. in this mode parity bit cannot be added. in the case of transmission, the msb (9th bit) is wr itten to sc0mod0. in the case of receiving, it is stored in sc0cr. when the buffer is written and read , the msb is read or written first, before the rest of the sc0buf data. 8.4.4.1 wakeup function in 9-bit uart mode, the wakeup function for slave controllers is enabled by setting sc0mod0 to ?1?. the interrupt intrx0 occurs only when = ?1?. note: the txd pin of each slave controll er must be in open-drain output mode. figure 8-14 serial link using wakeup function txd rxd 5ncxg txd rxd 5ncxg txd rxd 5ncxg txd rxd /cuvgt
page 159 2007-10-15 tmp91fw60 8.4.4.2 protocol 1. select 9-bit uart mode on th e master and slave controllers. 2. set the sc0mod0 bit on each slave contro ller to ?1? to enable data receiving. 3. the master controller transmits one-frame data in cluding the 8-bit select code for the slave con- trollers. the msb (bit8) is set to ?1?. 4. each slave controller receives th e above frame. each controller checks the above select code against its own select code. the controller w hose code matches clears its wu bit to ?0?. 5. the master controller transmits data to the specified slave controll er whose sc0mod0 bit is cleared to ?0?. the msb (bit8) is cleared to ?0?. 6. the other slave controllers (who se bits remain at ?1?) ignore the received data because their msbs (bit8 or ) are set to ?0?, disabling intrx0 interrupts. the slave controller (wu bit = ?0?) can transmit data to the master controller, and it is possible to indicate the end of data receiving to the master cont roller by this transmission. stop start bit 0 1 2 3 4 5 6 78 "1" select code of slave controller stop start bit 0 1 2 3 4 5 6 7bit 8 &cvc "0"
page 160 2007-10-15 tmp91fw60 8.4.4.3 example to link two slave controllers seri ally with the master controll er using the internal clock f sys as the transfer clock. main settings (exce pt port setting) register msb lsb 76543210 intes0 x100x101 enable the inttx0 interrupt and set it to interrupt level 4. enable the intrx0 interrupt and set it to interrupt level 5. sc0mod0 10101110 set f sys as the transmission clock for 9-bit uart mode. sc0buf 00000001set the select code for slave controller 1. inttx0 interrupt register msb lsb 76543210 sc0mod0 0???????set tb8 to ?0?. sc0buf ********set data for transmission. main settings (except port setting) register msb lsb 76543210 intes0 x 1 0 1 x 1 1 0 enable intrx0 and inttx0. sc0mod0 00111110 set to ?1? in 9-bit uart transmission mode using f sys as the transmission clock. intrx0 interrupt register msb lsb 76543210 acc sc0buf, if acc = select code then sc0mod0 ???0????clear to ?0?. txd rxd 5ncxg txd rxd 5ncxg txd rxd /cuvgt 5gngeveqfg 00000001 5gngeveqfg 00001010
page 161 2007-10-15 tmp91fw60 9. serial bus interface (sbi) the tmp91fw60 has a 2-channel serial bus interface which an i 2 c bus mode. this circuit supports only i 2 c bus mode (multi master). the serial bus interface is connected to an extern al device through sda0,scl0,sda1 and scl1 in the i 2 c bus mode. 9.1 configuration figure 9-1 serial bus interface (sbi) 9.2 serial bus int erface (sbi) control the following registers are used to control the serial bus interface and monitor the op eration status. ? serial bus interface control register 0 (sbi0cr0, sbi1cr0) ? serial bus interface control register 1 (sbi0cr1, sbi1cr1) ? serial bus interface control register 2 (sbi0cr2, sbi1cr2) ? serial bus interface data buffe r register (sbi0dbr, sbi1dbr) ?i 2 c bus address register (i2c0ar, i2c1ar) ? serial bus interface status register (sbi0sr, sbi1sr) ? idle2 control register (sbi0br, sbi1br) 0qkug ecpegnngt scl +prwv output control sda sdan scln   5jkhv tgikuvgt i 2 c bus fcvc eqpvtqn hu[u 0qvgp sbinbr sbin control register 2/ sbin status register sbin control  register 1 sbin baud rate registers i 2 c bus/ address register sbin data/ buffer register sbincr1 i2cnar sbincr2/ sbinsr sbindbr intsbi interrupt request transfer control  circuit noise canceller i 2 c bus clock sysn. control divider
page 162 2007-10-15 tmp91fw60 9.3 operation in i 2 c bus mode both channels operate in the same function except for th e following points; hence only the operation of channel 0 is explained below. 9.3.1 the data formats in the i 2 c bus mode the data formats in the i 2 c bus mode is shown below. figure 9-2 data format in the i 2 c bus mode 8 bits 1 1 or more 1 to 8 bits 1 1 s a c k a c k a c k p slave address data data 1 to 8 bits 1 r / w 8 bits 1 1 1 or more 1 or more 1 to 8 bits 1 1 1 s a c k a c k a c k p slave address data data slave address 1 to 8 bits 1 r / w 8 bits a c k r / w 8 bits 1 1 or more 1 to 8 bits 1 1 s a c k a c k a c k p s data data data 1 to 8 bits 1 (a) addressing format (b) addressing format (with restart) (c) free data format (data transferred from master device to slave device) s r/w ack p : start condition : direction bit : acknowledge bit : stop condition
page 163 2007-10-15 tmp91fw60 9.3.2 i 2 c bus mode control register the following registers are used to control and monitor the operation stat us when using the serial bus inter- face (sbi) in the i 2 c bus mode. serial bus interface control register 0 (read-modify-write instructions are prohibited.) 76543210 sbi0cr0 (0247h) bit symbol sbi0en??????? read/write r/w r after reset00000000 sbi1cr0 (024fh) bit symbol sbi1en??????? read/write r/w r after reset00000000 function sbi operation 0: disable 1: enable always read "0". note : when using sbi, shoul d be set "1" (sbi operation enable) before se tting each register of sbi module. serial bus interface control register 1 (read-modify-write instructions are prohibited.) 76543210 sbi0cr1 (0240h) bit symbol bc2 bc1 bc0 ack ? sck2 sck1 sck0/ swrmon read/write w r/w ? w r/w after reset0000?000/1 sbi1cr1 (0248h) bit symbol bc2 bc1 bc0 ack ? sck2 sck1 sck0/ swrmon read/write w r/w ? w r/w after reset0000?000/1 function number of transferred bits (note 1) acknowl- edge mode specification internal serial clock selection and software reset monitor (note 2) internal serial clock selection at write sck2:0 000 n = 4 ? (note3) system clock : fc clock gear: fc/1 fc =20 mhz (internal scl output) fscl = (f sys /2) / (2 n +36) [hz] 001 n = 5 73.53 khz 010 n = 6 50.00 khz 011 n = 7 30.49 khz 100 n = 8 17.12 khz 101 n = 9 9.12 khz 110 n = 10 4.72 khz 111 (reserved) (reserved) software reset state monitor at read swrmon 0 during software reset 1 initial data acknowledge mode specification ack 0 not generate clock pulse for acknowledge signal 1 generate clock pulse for acknowledge signal
page 164 2007-10-15 tmp91fw60 note 1: for the frequency of the scl line clock, see 9.3.3.3 ?serial clock?. note 2: initial data of sck0 is ?0?,swrmon is ?1?. note 3: this i 2 c bus circuit dose not support high-s peed mode, it supports standard mode only. the fscl speed can be selected over 100 kbps by fc and , however it?s irregular operation. number of bits transferred bc2:0 = 0 = 1 number of clock pulses bits number of clock pulses bits 0008898 0011121 0102232 0113343 1004454 1015565 1106676 1117787
page 165 2007-10-15 tmp91fw60 note 1: reading this register functions as sbi0sr/sbi1sr register. note 2: switch to port mode after confirming that the bus is free. switch a mode between i 2 c bus mode and clocked-synchronous 8-bit sio mode after confirming that input signals via port are high level. serial bus interface control register 2 (read-modify-write instructions are prohibited.) 76543210 sbi0cr2 (0243h) bit symbol mst trx bb pin sbim1 sbim0 swrst1 swrst0 read/write w w w after reset00010000 sbi1cr2 (024bh) bit symbol mst trx bb pin sbim1 sbim0 swrst1 swrst0 read/write w w w after reset00010000 function master/slave selection transmitter/ receiver selection start/stop condition generation cancel intsbi interrupt request serial bus interface opera- tion mode selection software reset generate software reset generate swrst1:0 10 01 write ?10? and ?01?, then an internal reset signal is generated serial bus interface operating mode selection (note 2) sbim1:0 00 port mode (serial bus interface output disabled) 01 (reserved) 10 i 2 c bus mode 11 (reserved) intsbi interrupt request pin 0? 1 cancel interrupt request start/stop condition generation bb 0 generates the stop condition 1 generates the start condition transmitter/receiver selection trx 0 receiver 1 transmitter master/slave selection mst 0slave 1master
page 166 2007-10-15 tmp91fw60 note 1: writing in this register functions as sbi0cr2/sbi1cr2. note 2: the initial data sbi0sr/sbi1sr is "1" if sbi operation is enable (sbi0cr0/sbi1cr0 "1"). if sbi operation is disable (sbi0cr0/sbi1cr0 "0"), the initial data of sbi0sr/sbi1sr is "0". serial bus interface status register (read-modify-write instructions are prohibited.) 76543210 sbi0sr (0243h) bit symbol mst trx bb pin al aas ad0 lrb read/write r after reset00010000 sbi1sr (024bh) bit symbol mst trx bb pin al aas ad0 lrb read/write r after reset00010000 function master/slave status moni- tor transmitter/ receiver sta- tus monitor i 2 c bus sta- tus monitor intsbi interrupt request monitor arbitration lost detection monitor slave address match detec- tion monitor general call detec- tion monitor last received bit monitor last received bit monitor lrb 0 last received bit was 0 1 last received bit was 1 general call detection monitor ad0 0 undetected 1 general call detected slave address match detection monitor aas 0 undetected 1 slave address match or general call detected arbitration lost detection monitor al 0? 1 arbitration lost detected intsbi interrupt request monitor pin 0 interrupt requested 1 interrupt canceled i 2 c bus status monitor bb 0free 1busy transmitter/receiver status monitor trx 0 receiver 1 transmitter master/slave status monitor mst 0slave 1master
page 167 2007-10-15 tmp91fw60 note 1: when writing transmitted data, start from the msb (bit7).receiving data is placed from lsb (bit0). note 2: sbi0dbr can?t be read the written data. therefore read-m odify-write instruction (e.g., ?bit? instruction) is prohibitted . idle2 control register (read-modify-write instru ctions are prohibited.) 76543210 sbi0br (0244h) bit symbol ? i2sbi0 ? ? ? ? ? ? read/write w r/w ? ? ? ? ? r/w after reset00?????0 sbi1br (024ch) bit symbol ? i2sbi1 ? ? ? ? ? ? read/write w r/w ? ? ? ? ? r/w after reset00?????0 function always write ?0? operation in idle2 mode 0: stop 1: operate always write ?0? serial bus interface data buffer register (read-modify-write instru ctions are prohibited.) 76543210 sbi0dbr (0241h) bit symbol db7 db6 db5 db4 db3 db2 db1 db0 read/write r (received)/w (transfer) after reset undefined sbi1dbr (0249h) bit symbol db7 db6 db5 db4 db3 db2 db1 db0 read/write r (received)/w (transfer) after reset undefined i 2 c bus address register (read-modify-write instructions are prohibited.) 76543210 i2c0ar (0242h) bit symbol sa6 sa5 sa4 sa3 sa2 sa1 sa0 als read/write w after reset00000000 i2c1ar (024ah) bit symbol sa6 sa5 sa4 sa3 sa2 sa1 sa0 als read/write w after reset00000000 function slave address selection for wh en device is operatin g as slave device address recognition mode speci- fication address recognition mode specification als 0 slave address recognition 1 non slave address recognition
page 168 2007-10-15 tmp91fw60 9.3.3 control in i 2 c bus mode 9.3.3.1 acknowledge mode specification set the sbi0cr1 to ? 1 ? for operation in the acknowledge mode. the tmp91fw60 generates an additional clock pulse for an acknowledge signal when operating in master mode. in the transmitter mode during the clock pulse cycle, the sda pin is released in order to receive the acknowledge signal from the receiver. in the receiver mode during the clock pulse cycle, the sda pin is set to the low in order to gener- ate the acknowledge signal. clear the to ? 0 ? for operation in the non-acknowledge mode, the tmp91fw60 does not gener- ate a clock pulse for the acknowledge signal when operating in the master mode. 9.3.3.2 number of transfer bits the sbi0cr1 is used to se lect a number of bits for next transmitting and receiving data. since the is cleared to ? 000 ? as a start condition, a slave addr ess and direction bit transmission are always executed in 8 bits. other than th ese, the retains a specified value. 9.3.3.3 serial clock (1) clock source the sbi0cr1 is used to select a maximum transfer frequency outputted on the scl pin in master mode. set the baud rates, which have been calculated according to the formula below, to meet the specifications of the i2c bus, such as the smallest pulse width of tlow. figure 9-3 clock source note: f sbi shows f sys /2 t low = (2 n ? 1 +29)/f sbi t high = (2 n ? 1 +7)/f sbi fscl = 1/(t low + t high ) = f sbi /(2 n + 36) sbi0cr1 n 000 001 010 011 100 101 110 4 5 6 7 8 9 10 1/fscl t low t high
page 169 2007-10-15 tmp91fw60 (2) clock synchronization in the i 2 c bus mode, in order to wired-and a bus, a master device which pulls down a clock line to low level, in the first place, invalidate a cloc k pulse of another master device which generates a high-level clock pulse. the master device with a high-level clock pulse needs to detect the situation and implement the fo llowing procedure. the tmp91fw60 has a clock synchronization functi on for normal data transfer even when more than one master exists on the bus. the example explains the clock synchronization procedures wh en two masters simultaneously exist on a bus. figure 9-4 clo ck synchronization as master a pulls down the internal scl output to the low level at point ?a?, the scl line of the bus becomes the low level. after detecting this s ituation, master b resets a counter of high-level width of an own clock pulse and sets the internal scl output to the low level. master a finishes counting low-level width of an own clock pulse at point ?b? and sets the internal scl output to the high level. since master b holds th e scl line of the bus at the low level, master a waits for counting high-level width of an own cloc k pulse. after master b finishes counting low- level width of an own clock pulse at point ?c? and master a detects the scl line of the bus at the high level, and starts counting high level of an ow n clock pulse. the clock pulse on the bus is deter- mined by the master device with the shortest high-l evel width and the master device with the longest low-level width from among those master devices connected to the bus. 9.3.3.4 slave address and address recognition mode specification when the tmp91fw60 is used as a slave device, set the slave address and to the i2c0ar. clear the to ?0? for the address recognition mode. 9.3.3.5 master/slave selection set the sbi0cr2 to ?1? for operating the tmp91fw60 as a master device. clear the sbi0cr2 to ?0? for operation as a slave devi ce. the is cleared to ?0? by the hardware after a stop condition on the bus is detected or arbitration is lost. abc internal scl output (master a) internal scl output (master b) scl pin start counting high-level width of a clock pulse reset a counter of high-level width of a clock pulse wait counting high-level width of a clock pulse
page 170 2007-10-15 tmp91fw60 9.3.3.6 transmitter/receiver selection set the sbi0cr2 to ?1? for operating the tmp91fw60 as a tr ansmitter. clear the to ?0? for operation as a receiver. when data with an addressing form at is transferred in slave mode, when a slave address with the same value that an i2c0ar or a general call is received (all 8-bit data ar e ?0? after a start condition), the is set to ?1? by the hardware if the direction bit (r/ w ) sent from the master device is ?1?, and is cleared to ?0? by the ha rdware if direction bit is ?0?. in the master mode, after an ac knowledge signal is returned fr om the slave device, the is cleared to ?0? by the hardware if a transmitted directio n bit is ?1?, and is set to ?1? by the hard- ware if direction is ?0?. when an acknowledge signal is not returned, the current condition is maintained. the is cleared to ?0? by the hard ware after a stop condition on the i 2 c bus is detected or arbitra- tion is lost. 9.3.3.7 start/stop condition generation when the sbi0sr is ?0?, slave address and di rection bit which are set to sbi0dbr are output on a bus after generating a start cond ition by writing ?1? to the sbi0cr2. it is neces- sary to set transmitted data to the data buffer register (sbi0dbr) and set ?1? to beforehand. figure 9-5 start condition generat ion and slave address generation when the is ?1?, a sequence of generating a stop condition is started on the bus by writing ?1? to the , and ?0? to the . do not mo dify the contents of until a stop condition is generated on the bus. figure 9-6 stop condition generation the state of the bus can be ascer tained by reading the contents of sbi0sr. sbi0sr will be set to ?1? if a start condition has been detected on th e bus, and will be cleared to ?0? if a stop condition has been detected. a6 a5 2 3 4 5 6 7 8 9 a4 a3 a2 a1 a0 r/ w 1 slave address and the direction bit scl pin sda pin start condition acknowledge signal scl pin sda pin stop condition
page 171 2007-10-15 tmp91fw60 9.3.3.8 interrupt service requests and interrupt cancellation when a serial bus interface interr upt request (intsbi) occurs, the sbi0cr2 is cleared to ?0?. during the time that the sbi0cr2 is ?0?, the scl line is pulled down to the low level. the is cleared to ?0? when an 1 word of da ta is transmitted or receive d. either writing/reading data to/from sbi0dbr sets the to ?1?. the time from the being set to ?1? until the scl line is released takes t low . in the address recognition mode ( = ?0?),

is cleared to ?0? when the received slave address is the same as the value set at the i2c0ar or when a general call is received (all 8-bit data are ?0? after a start condi tion). although sbi0cr2 can be set to ?1? by the program, the is not cleared to ?0? when it is written ?0?. 9.3.3.9 serial bus interface operation mode selection sbi0cr2 is used to specify the serial bus interface operation mode. set sbi0cr2 to ?10? when the device is to be used in i 2 c bus mode after confirming pin condition of serial bus interface to ?h?. switch to port mode after confirming a bus is free. 9.3.3.10 arbitration lost detection monitor since more than one master device can exist simultaneously on the bus in i 2 c bus mode, a bus arbitra- tion procedure has been implem ented in order to guarantee the integrity of transferred data. data on the sda line is used for i 2 c bus arbitration. the following shows an example of a bus arbitration procedure when two master devices exist simulta- neously on the bus. master a and master b output th e same data until point ?a?. after master a outputs ?l? and master b, ?h?, the sda line of the bus is wired-and and the sda line is pulled down to the low level by master a. when the scl line of the bus is pul led up at point b, the slave device reads the data on the sda line, that is, data in master a. a data tr ansmitted from master b becomes invalid. the state in master b is called ?arbitration lost?. master b device which loses arbitra tion releases the internal sda output in order not to affect data transmitted from other masters with arbitration. when more than one master sends the same data at the first word, arbitration occurs continuou sly after the second word. figure 9-7 arbitration lost the tmp91fw60 compares the levels on the bus?s sda line with those of the internal sda output on the rising edge of the scl line. if the levels do not match, arbitration is lost and sbi0sr is set to ?1?. ab scl pin internal sda output (master a) internal sda output (master b) sda pin internal sda output becomes 1 after arbitration has been lost.
page 172 2007-10-15 tmp91fw60 when sbi0sr is set to ?1?, sbi0sr are cleared to ?00? and the mode is switched to slave receiver mode. thus, clock output is sto pped in data transfer after setting = ?1?. sbi0sr is cleared to ?0 ? when data is written to or read from sbi0dbr or when data is written to sbi0cr2. figure 9-8 example of when tmp91fw60 is a master de vice b (d7a = d7b, d6a = d6b) 9.3.3.11 slave address match detection monitor sbi0sr is set to ?1? in sl ave mode, in address recognition mode (e.g., when i2c0ar = ?0?), when a general call is recei ved, or when a slave address matches the value set in i2c0ar. when i2c0ar = ?1?, sbi0sr is set to ?1? after the first word of data has been received. sbi0sr is cleared to ?0? when data is written to or read from the data buffer register sbi0dbr. 9.3.3.12 general call detection monitor sbi0sr is set to ?1? in slave mode, when a general call is r eceived (all 8-bit received data is ?0? after a start condition). sbi0sr is cleared to ?0? when a start condition or stop condi- tion is detected on the bus. 9.3.3.13 last received bit monitor the sda line value stored at the rising edge of the scl line is set to the sbi0sr. in the acknowledge mode, immediately after an intsbi interrup t request is generated, an acknowledge signal is read by reading the conten ts of the sbi0sr. 9.3.3.14 software reset function the software reset function is used to initialize th e sbi circuit, when sbi is locked by external noises, etc. an internal reset signal pulse can be generated by setting sbi0cr2 to ?10? and ?01?. this initializes the sbi circuit internally. all control registers and status registers are initialized as well. sbi0cr1 is automatically set to ?1? after the sbi circuit has been initialized. note: if the software reset is executed, operation selection is reset, and its mode is set to port mode from i 2 c mode. d7a d6a d5a d4a d7b d6b d3a d2a d1a d6a' d7a' d5a' d4a' d0a 1 2 3 4 1 2 3 4 5 6 7 8 9 1 2 3 4 internal scl output accessed to sbi0dbr or sbi0cr2 internal sda output internal scl output internal sda output master a master b stop the clock pulse keep internal sda output to high level as losing arbitration
page 173 2007-10-15 tmp91fw60 9.3.3.15 serial bus interface data buffer register (sbi0dbr) the received data can be read and transferred data can be written by readi ng or writing the sbi0dbr. in the master mode, after the start condition is generated the slave address and the direction bit are set in this register. 9.3.3.16 i 2 cbus address register (i2c0ar) i2c0ar is used to set the slave address when the tmp91fw60 functions as a slave device. the slave address output from the master device is recognized by setting the i2c0ar to ?0?. the data format is the addressing format. when the slave address is not recognized at the = ?1?, the data format is the free data format. 9.3.3.17 setting register for idle2 mode operation (sbi0br0) sbi0br0 is the register setting operat ion/stop during idle2 mode. therefore, setting is necessary before th e halt instruction is executed. 9.3.4 data transfer in i 2 c bus mode 9.3.4.1 device initialization set the sbi0cr1, clear bits 2 to 0 and 4 in the sbi0cr1 to ?0?. set a slave address and th e ( = ?0? when an ad dressing format) to the i2c0ar. for specifying the default setting to a slave receive r mode, clear ?0? to the sbi0cr2, set ?1? to the , ? 10? to the , and write ?0? to bit 1, 0. 76543210 sbi0cr1 x x x 0 x 0 0 0 set acknowledge and scl clock. i2c0ar x x x x x x x 0 set slave address and address recognition mode. sbi0cr2 00011000 set to slave receiver mode. note: x: don?t care
page 174 2007-10-15 tmp91fw60 9.3.4.2 start condition and slave address generation (1) master mode in the master mode, the star t condition and the slave address are generated as follows. check a bus free status (when = ?0?). set the sbi0cr1 to ?1? (acknowledge mode ) and specify a slave address and a direction bit to be transmitted to the sbi0dbr. when sbi0cr2 = ?0?, the start condition are generated by writing ?1? to sbi0cr2. subsequently to the start condition, nine clocks are output from the scl pin. while eight clocks are output, th e slave address and the direction bit wh ich are set to the sbi0dbr. at the 9th clock, the sda line is releas ed and the acknowledge signal is received from the slave device. an intsbi0 interrupt request occurs at the falling edge of the 9th clock. the is cleared to ?0?. in the master mode, the scl pin is pulled dow n to the low level while is ?0?. when an interrupt request occurs, the is changed according to the dir ection bit only when an acknowl- edge signal is returned from the slave device. in intsbi0 interrupt routine intclr <-- 0x30 ; clear the interrupt request process end of interrupt (2) slave mode in the slave mode, the start conditio n and the slave address are received. after the start condition is receive d from the master device, while eight clocks are output from the scl pin, the slave address and the direction bit whic h are output from the mast er device are received. when a general call or the same address as the slave address set in i2c0ar is received, the sda line is pulled down to the low level at the 9th clock, and the acknowledge signal is output. an intsbi0 interrupt request occurs on the falling edge of the 9th clock. the is cleared to ?0?. in slave mode the scl line is pulled down to the low level while the = ?0?. setting in main routine 76543210 reg sbi0sr reg reg. 0x20 if reg 0x00 wait until bus is free. then sbi0cr1 x x x 1 x 0 0 0 set to acknowledgement mode. sbi0dbr x x x x x x x x set slave address and direction bit. sbi0cr2 11111000 generate start condition.
page 175 2007-10-15 tmp91fw60 figure 9-9 start condition gener ation and slave address transfer 9.3.4.3 1-word data transfer check the by the intsbi0 inte rrupt process after the 1-word da ta transfer is completed, and determine whether the mode is a master or slave. (1) if = ?1? (master mode) check the and determine whether th e mode is a transmitter or receiver. (a) when the = ?1? (transmitter mode) check the . when is ?1?, a receive r does not request da ta. implement the pro- cess to generate a stop condition (refer to below) and terminate data transfer. when the is ?0?, the receiver requests ne w data. when the next transmitted data is 8 bits, write the transmitted data to sbi0dbr. wh en the next transmitted data is other than 8 bits, set the and write the transmitted data to sbi0dbr. after written the data, becomes ?1?, a seri al clock pulse is generated for transferring a new 1 word of data from the scl pin, and then the 1-word data is transmitted. after the data is transmitted, an intsbi interrupt request occurs. the becomes ?0? and the scl line is pulled down to the low level. if the data to be transferred is mo re than one word in lengt h, repeat the procedure from the checking above. if mst = 0 then shift to the process when slave mode if trx = 0 then shift to the process when receiver mode. if lrb = 0 then shift to the process that generates stop condition. 76543210 sbi0cr1 0 0 0 1 x x x x set the bit number of transmit and ack. sbi0dbr xxxxxxxx write the transmit data. end of interrupt note: x: don?t care a6 a5 2 3 4 5 6 7 8 9 a4 a3 a2 a1 a0 ack r/w 1 scl pin sda pin intsbi interrupt request start condition slave address + direction bit output of master output of slave acknowledge signal from a slave device
page 176 2007-10-15 tmp91fw60 figure 9-10 example in wh ich = ?000? and = ?1? in transmitter mode (b) when the is ?0? (receiver mode) when the next transmitted data is other than 8 bits, set and read the received data from sbi0dbr to release the scl line (data which is read immediately after a slave address is sent is undefined). after the data is read, becomes ?1?. serial clock pulse for transferring new 1 word of data is defined scl and outputs ?l? level from sda pin with acknowledge timing. an intsbi0 interrupt request then occurs and the becomes ?0?, then the tmp91fw60 pulls down the scl pin to the low level. the tmp91fw60 outputs a clock pulse for 1 word of data tran sfer and the acknowledge signal each ti me that received data is read from the sbi0dbr. figure 9-11 example of when = ?000?, = ?1 ? in receiver mode in order to terminate the transmission of da ta to a transmitter, cl ear to ?0? before reading data which is 1 word before the last da ta to be received. the last data word does not generate a clock pulse as the acknowledge signal. after the data has been transmitted and an interrupt request has been generated, set to ?001? and read the data. the tmp91fw60 generates a clock pulse for an 1-bit data transfer. since the master device is a receiver, the sda line on the bus remains high. the transmitter interprets the high signal as an ack signal. the receiver indicates to the tran smitter that data transfer is complete. after the one data bit has been received a nd an interrupt request been generated, the tmp91fw60 generates a stop condition and terminates data transfer. d7 d6 2 3 4 5 6 7 8 9 d5 d4 d3 d2 d1 d0 ack 1 scl pin write to sbi0dbr sda pin intsbi interrupt request output from master output from slave acknowledge signal from a receiver d7 d6 2 3 4 5 6 7 8 9 d5 d4 d3 d2 d1 ack 4 d7 d0 1 scl pin read sbi0dbr sda pin intsbi interrupt request output from master output from slave acknowledge signal to a
page 177 2007-10-15 tmp91fw60 figure 9-12 termination of data transfer in mast er receiver mode (2) if = 0 (slave mode) in the slave mode the tmp91fw60 operates either in normal slav e mode or in slave mode after losing arbitration. in the slave mode, an intsbi0 interrupt request occurs when the tmp91fw60 receives a slave address or a general call from the master device, or when a general call is received and data transfer is complete, or af ter matching received address. in the master mode, the tmp91fw60 operates in a slave mode if it detects losing arbitr ation. an intsbi0 interrupt request occurs when a word data transfer terminates af ter losing arbitration. when an in tsbi0 interrupt request occurs the is cleared to ?0? and the scl pin is pulled down to the low level. either reading/writing from/ to the sbi0dbr or setting the to ?1 ? will release the scl pin after taking t low time. check the sbi0sr, , , and and implements processes according to conditions listed in the next table. example: in case receive data n times intsbi0 interrupt (after transmitting data) 76543210 sbi0cr1 x x x x x x x x set the bit number of receive data and ack. reg. sbi0dbr load the dummy data. end of interrupt intsbi0 interrupt (receive data of 1st to (n 2) th) 76543210 reg. sbi0dbr load the data of 1st to (n 2)th. end of interrupt intsbi0 interrupt ((n 1) th receive data) 76543210 sbi0cr1 x x x 0 0 x x x not generate acknowledge signal reg. sbi0dbr load the data of (n 1)th end of interrupt intsbi0 interrupt (nth receive data) 76543210 sbi0cr1 0 0 1 0 0 x x x generate the clock for 1bit transmit reg. sbi0dbr receive the data of nth. end of interrupt intsbi0 interrupt (after receiving data) the process of generating stop condition finish the transmit of data end of interrupt note: x: don?t care d7 d6 2 9 3 4 5 6 7 8 1 d5 d4 d2 d3 d1 d0 1 scl pin sda pin intsbi interrupt request "0"  read sbi0dbr "001"  read sbi0dbr output of master output of slave acknowledge si g sent to a transmi t
page 178 2007-10-15 tmp91fw60 example: in case matching slave address in slave receive mode, direction bit is "1". intsbi0 interrupt if trx = 0 then shift to other process if al = 1 then shift to other process if aas = 0 then shift to other process 76543210 sbi0cr1 x x x 1 x x x x set the bit number of transmit. sbi0dbr x x x x x x x x set the data of transmit. note: x: don?t care table 9-1 operation in the slave mode conditions process 1 110 the tmp91fw60 loses arbitration when transmitting a slave address and receives a slave address for which the value of the direction bit sent from another master is ?1?. set the number of bits a word in and write the transmitted data to sbi0dbr. 0 10 in slave receiver mode, the tmp91fw60 receives a slave address for which the value of the direction bit sent from the master is ?1?. 00 in slave transmitter mode, a single word of data is transmitted. check the setting. if is set to ?1?, set to ?1? since the receiver win no request the data which follows. then, clear to ?0? to release the bus. if is cleared to ?0?, set to the number of bits in a word and write the transmitted data to sbi0dbr since the receiver requests next data. 0 1 11/0 the tmp91fw60 loses arbitration when transmitting a slave address and receives a slave address or general call for which the value of the direction bit sent from another master is ?0?. read the sbi0dbr for setting the to ?1? (reading dummy data) or set the to ?1?. 00 the tmp91fw60 loses arbitration when transmitting a slave address or data and terminates word data transfer. 0 11/0 in slave receiver mode, the tmp91fw60 receives a slave address or general call for which the value of the direction bit sent from the master is ?0?. 01/0 in slave receiver mode, the tmp91fw60 terminates receiving word data. set to the number of bits in a word and read the received data from sbi0dbr.
page 179 2007-10-15 tmp91fw60 9.3.4.4 stop condition generation when sbi0sr = ?1?, the sequence for generating a stop condition is started by writing ?1? to sbi0cr2 and ?0? to sbi0cr2. do not modify the contents of sbi0cr2 until a stop condition has been generated on the bus. when the bus?s scl line has been pulled low by another device, the tmp91fw60 gene rates a stop condition when the other device has released the scl line and sda pin rising. figure 9-13 stop condition generation (single master) figure 9-14 condition g eneration (multi master) 76543210 sbi0cr2 1 1 0 1 1 0 0 0 generate stop condition. internal scl 1  "1"  "0"  "1"  sda pin (read) stop condition scl pin internal scl "1"  "1"  "0"  "1"  sda pin (read) stop condition the case of pulled low by another device
page 180 2007-10-15 tmp91fw60 9.3.4.5 restart restart is used during data transfer between a mast er device and a slave to change the data transfer direction. the following description explains how to rest art when the tmp91fw60 is in master mode. clear sbi0cr2 to ?0? and set sbi0 cr2 to ?1? to release the bus. the sda line remains high and the scl pin is released. since a stop condition has not been generated on the bus, other devices assume the bus to be in busy state. and confirm scl pin, that scl pin is released and become bus-free state by sbi0sr = ?0? or signal level ?1? of scl pin by sensing its port (chang e to input mode). check the until it becomes ?1? to check that the scl line on a bus is not pulled down to the low level by other devices. after con- firming that the bus remains in a free state, genera te a start condition using the procedure described in 9.3.4.2. in order to satisfy the setup time requirem ents when restarting, take at least 4.7 s of waiting time by software from the time of restarting to confirm that th e bus is free until the time to generate the start con- dition. figure 9-15 timing diagr am for tmp91fw60 restart note: don't write "0", when "0" condition. (cannot be restarted) 76543210 sbi0cr2 00011000 release the bus if sbi0sr 0 check if scl pin is released. then if sbi0sr 1 check if scl pin of other device is "l" level. then 4.7us wait sbi0cr1 0 0 0 1 0 x x x set acknowledgement mode. sbi0dbr x x x x x x x x set the slave address and direction bit. sbi0cr2 11111000 generate start condition. note: x: don?t care "0"  "0"  "0"  "1"  "1"  "1"  "1"  "1"  9 internal scl scl pin sda pin start condition 4.7 s (min)
page 181 2007-10-15 tmp91fw60 10. 10-bit ad converter (adc) the tmp91fw60 have a 10-bit successive approximation ty pe ad converter. 10.1 configuration the circuit configuration of the 10-bit ad converter is shown in figure 10-1 . it consists of control register adccr1 and adccr2, converted value register adcdrh and adcdrl, a da converter, a sample-hold circuit, a compar ator, and a successive comparison circuit. note: before using ad converter, set appropriate value to i/o port register combining a analog input port. for details, see the sec- tion on "i/o ports". figure 10-1 10-bit ad converter 10.2 register configuration the ad converter consists of the following four registers: 1. ad converter control register 1 (adccr1) this register selects the analog channels and operation mode (single or repeat) in which to perform ad conversion and controls the ad converter as it starts operating. 2. ad converter control register 2 (adccr2) this register selects the ad conversion time and co ntrols the connection of the da converter (ladder resistor network) and monitors the operating status of the ad converter. 3. ad converted value register (adcdrh, adcdrl) this register used to store the digital value after being converted by the ad converter. #0 #0   #0 #0 #%-  5#+0 #+0'0 #& 4 5    8 4'(*  # 855       # $      1 2 ; '0    5   #&%%4  # 8%%  4 4 4   #/&  #&%%4 #&%&4.  #&%&4*   ' 1 % ( # & $ ( +06#&      45'.  analog input multiplexer da converter sample hold circuit reference voltage analog comparator shift clock control circuit ad conversion result register 1, 2 ad converter control register 1, 2 successive approximate circuit 5gngevqt
page 182 2007-10-15 tmp91fw60 note 1: select analog input channel during ad converter stops (adccr2 = ?0?). note 2: when the analog input channel is all use dis abling, the adccr1 should be set to ?0?. note 3: during conversion, do not perform port output instruction to maintain a precision for all of the pins because analog inp ut port use as general input port. and for port near to anal og input, do not input intense signaling of change. note 4: the adccr1 is automatically cleared to ?0? after starting conversion. note 5: do not set adccr1 newly again during ad conv ersion. before setting adccr1 newly again, check adcdr2 to see that the conversion is completed or wait until the interrupt signal (intadc) is generated (e.g., interrupt handling routine). note 6: starting of stop mode, slow mode, and the idle1 mode initializes the ad control register 1 (adccr1) except for sain. moreover, in the case of the idle2 mode, it controls by the bit of adccr2. therefore, to use ad converter again, set the adccr1 newly after returning to normal mode. note 1: starting of stop mode, slow mode, and the idle1 mode in itializes the ad control register 2 (adccr2) except for ack and i2ad. moreover, in the case of the idle2 mode, it controls by the bit of adccr2. therefore, to use ad con- verter again, set the adccr2 newly after returning to norm al mode. therefore, the ad conversion result should be read to adcdrl more first than adcdrh. note 2: the adccr2 is cleared to ?0? when reading the adcdrh. note 3: the adccr2 is set to ?1? when ad conversi on starts, and cleared to ?0? when ad conversion finished. ad converter control register 1 76543210 adccr1 (02b0h) bit symbol adrs amd ainen sain read/write r/w after reset00000000 function ad conver- sion start 0: - 1: ad con- version start ad operating mode 00: ad operation disable 01: single mode 10: reserved 11: repeat mode analog input control 0:disable 1:enable analog input channel select 0000: an0 0001: an1 0010: an2 0011: an3 0100: an4 0101: an5 0110: an6 0111: an7 1000: an8 1001: an9 1010: an10 1011: an11 1100: an12 1101: an13 1110: an14 1111: an15 ad converter control register 2 ( read-modify-write instructions are prohibited.) 76543210 adccr2 (02b1h) bit symbol eocf adbf rsel i2ad ack read/write r r/w after reset00001100 function ad conver- sion end flag 0:before or during con- version 1: conver- sion com- pleted ad conver- sion busy flag 0: during stop of ad conversion 1: during ad conversion storing of an ad conver- sion result 0: 10bit mode 1: 8bit mode idle2 con- trol 0:stop 1:operation ad conversion time select see" table 10-1 ack setting and conversion time "
page 183 2007-10-15 tmp91fw60 note 1: setting for ?-? in the above table are inhibite d. fc: high fr equency oscillation clock [hz] note 2: set conversion time setting should be kept mo re than the following time by analog reference voltage. note: at the time of 10-bit storing mode, if the bit 7 to 2 of adcdrh is read, ?0? will be read. table 10-1 ack setting and conversion time condition conversion time 20mhz 16mhz 10 mhz 8mhz 4 mhz 2 mhz ack 0xxx reserved 1000 reserved 1001 reserved 1010 78/fc ???? 19.5 s 39.0 s 1011 156/fc ?? 15.6 s 19.5 s 39.0 s 78.0 s 1100 312/fc 15.6 s 19.5 s 31.2 s 39.0 s 78.0 s156.0 s 1101 624/fc 31.2 s 39.0 s 62.4 s 78.0 s 156.0 s ? 1110 1248/fc 62.4 s 78.0 s 124.8 s 156.0 s ?? 1111 reserved ? v refh = 4.5 to 5.5 v 15.6 us and more ad converted value register h (8-bit storing mode) 76543210 adcdrh (02b3h) bit symbol ad09 ad08 ad07 ad06 ad05 ad04 ad03 ad02 read/write r after reset00000000 ad converted value register h (10-bit storing mode) 76543210 adcdrh (02b3h) bit symbol ?????? ad09 ad08 read/write r after reset00000000 ad converted value register l 76543210 adcdrl (02b2h) bit symbol ad07 ad06 ad05 ad04 ad03 ad02 ad01 ad00 read/write r after reset00000000
page 184 2007-10-15 tmp91fw60 10.3 function 10.3.1 single mode after setting adccr1 to ?01? (single mode), set adccr1 to ?1?. ad conversion of the voltage at the analog input pin specifi ed by adccr1 is thereby started. after completion of the ad conversion, the conversion result is stored in ad converted value registers (adcdrh, adcdrl) and at the same time adccr2 is set to 1, the ad conversion finished inter- rupt (intadc) is generated. adccr1 is automatically cleared after ad c onversion has started. do not set adccr1 newly again (restart) during ad conversion. before setting adccr1 newly again, check adccr2 to see that the convers ion is completed or wait until th e interrupt signal (intadc) is gen- erated (e.g., interrupt handling routine). figure 10-2 single mode #&%&4zuvcvwu #&%%4'1%( +06#&%kpvgttwrvtgswguv #&%%4#&$( #&%%4#&45 #&%&4* #&%&4. conversion result read conversion result read conversion result read conversion result read indeterminate 1st conversion result 2nd conversion result ad conversion start ad conversion start eocf cleared by reading conversion result
page 185 2007-10-15 tmp91fw60 10.3.2 repeat mode ad conversion of the voltage at the analog input pin specified by adccr1 is performed repeat- edly. in this mode, ad conversion is star ted by setting adccr1 to ?1? after setting adccr1 to ?11? (repeat mode). after completion of the ad conversion, the conversion result is stored in ad converted value registers (adcdrl, adcdrh) and at the same time adccr2 is set to 1, the ad conversion finished inter- rupt (intadc) is generated. in repeat mode, each time one ad conversion is complete d, the next ad conversion is started. to stop ad conversion, set adccr1 to ?00? (disable mode) by writing 0s. the ad convert operation is stopped immediately. the converted valu e at this time is not stored in the ad converted value register. figure 10-3 repeat mode 10.3.3 regi ster setting 1. set up the ad converter control re gister 1 (adccr1) as follows: ? choose the channel to ad convert using ad input channel select (sain). ? specify analog input enable fo r analog input control (ainds). ? specify amd for the ad converter control operation mode (ssingle or repeat mode). 2. set up the ad converter control re gister 2 (adccr2) as follows: set the ad conversion time using ad conversion time (ack). for details on how to set the con- version time, refer to table 10-1 and ad converter control register 2. 3. after setting up (1) and (2) above, set ad conversion st art (adrs) of ad converter control register 1 (adccr1) to ?1?. if software start mode has been selected, ad conversi on starts immediately. 4. after an elapse of the specified ad conversion time, the ad converted value is stored in ad con- verted value register (adcdrh and adcdrl) and the ad conversion finished flag (eocf) of ad converter control register 2 (adccr2) is set to ?1?, upon which time ad conversion interrupt intadc is generated. 5. eocf is cleared to ?0? by a read of the conversion re sult. however, if reconv erted before a register read, although eocf is cl eared the previous conversi on result is retained until the next conversion is completed.  #/&  '1%(   #&45   +06#&     #&%&4z        #/&  conversion operation ad conversion start 1st conversion result 2nd conversion result 3rd conversion result indeterminate 1st conversion result 3rd conversion result conversion result read ad convert operation suspended. conversion result is not stored. when not performing conversion result read-out, eocf is not cleared and a conversion result is not stored.
page 186 2007-10-15 tmp91fw60 10.4 idle1/stop/slow mo des during ad conversion when standby mode (idle1,stop or slow mode) is entered forcibly during ad conversion, the ad convert operation is suspended and the ad converter is initialized (adccr1 and adccr2 are initia lized to initial value). also, the conversion result is indeterminate. (conversion re sults up to the previous operation are cleared, so be sure to read the conversion results before entering standby mode (idle1,stop or slow mode).) when restored from standby mode (idle1,stop or slow m ode), ad conversion is not automatical ly restarted, so it is necessary to restart ad conversion. note that since the analog reference voltage is automati cally disconnected, there is no possi- bility of current flowing into the analog reference voltage. moreover, in the case of the idle2 mode, it controls by the bit of adccr2. example :after selecting the conversion time 19.5 s at 16 mhz and the analog input channel ain3 pin, perform ad con- version once. after checking eocf, read the converted value, store the lower 2 bits in address 0009eh nd store the upper 8 bits in address 0009fh in ram. the operation mode is single mode. ld (adccr1) , 00110011b ; select ain3 ld (adccr2) , 00001100b ;select conversion time(312/fc) and operation mode set (adccr1) . 7 ; adrs = 1(ad conversion start) sloop : test (adccr2) . 7 ; eocf= 1 ? jrs t, sloop ld a , (adcdrl) ; read result data ld (9eh) , a ld a , (adcdrh) ; read result data ld (9fh), a
page 187 2007-10-15 tmp91fw60 10.5 analog input voltage and ad conversion result the analog input voltage is corresponded to the 10-bit digital value converted by the ad as shown in figure 10-4 . figure 10-4 analog i nput voltage and ad c onversion result (typ.) 1 0 01 h 02 h 03 h 3fd h 3fe h 3ff h 2 3 1021 1022 1023 1024 1024 ? 9 8 4'(* # 85 5 analog input voltage a d conversion result
page 188 2007-10-15 tmp91fw60 10.6 precautions about ad converter 10.6.1 analog input pin voltage range make sure the analog input pins (an0 to an15) are used at voltages within v refh to a vss . if any voltage outside this range is applied to one of the analog input pins, the converted value on that pin becomes uncertain. the other analog input pins also are affected by that. 10.6.2 analog input shared pins the analog input pins (an0 to an15) are shared with input/output ports. when using any of the analog inputs to execute ad convers ion, do not execute in put/output instructions for all other ports. this is necessary to prevent the accuracy of ad conversi on from degrading. not only these analog input shared pins, some other pins may also be affected by noise arising from input/o utput to and from adjacent pins. 10.6.3 noise countermeasure the internal equivalent circuit of the analog input pins is shown in figure 10-5 . the higher the output imped- ance of the analog input source, more easily they are su sceptible to noise. therefor e, make sure the output impedance of the signal source in your design is 5k or less. toshiba also reco mmends attaching a capacitor external to the chip. figure 10-5 analog i nput equivalent circuit and exam ple of input pin processing  ani 4m6[r m/cz %r(
6[r pqvg kvq da converter analog comparator internal resistance internal capacitance permissible signal source impedance
page 189 2007-10-15 tmp91fw60 11. program patch logic the tmp91fw60 has a program patch logic, which enables the user to fix the program code in the on-chip rom without generating a new mask. patch program must be re ad into on-chip ram from external memory during the startup routine. up to six two-byte sequences, or banks (twelve bytes in total) can be replaced with patch code. more significant code correction can be performed by replacing program code with single-byte instruction code which generates a software interrupt (swi) to make a branch to a specified location in the on-chip ram area. the program patch logic only compares addresses in the on-chip rom area; it cannot fix the program code in the on-chip peripheral, on-chip ram and external rom areas. each of six banks is independently programmable, and f unctionally equivalent. in the following sections, any ref- erences to bank0 also apply to other banks. 11.1 block diagram figure 11-1 progr am patch logic diagram %27 #fftguudwu
$cpm #fftguueqorctgtgikuvgtu
41/%/2vq41/%/2 41/4&
$cpm #fftguuuwduvkvwvkqp tgikuvgtu
41/57$.* &cvcdwu 41/ #fftguueqorctgdnqem 1wvrwveqpvtqndnqem /cvej ukipcn 41/4& 1wvrwv gpcdng
$cpm #fftguueqorctgtgikuvgtu
41/%/2vq41/%/2
$cpm #fftguueqorctgtgikuvgtu
41/%/2vq41/%/2
$cpm #fftguueqorctgtgikuvgtu
41/%/2vq41/%/2
$cpm #fftguueqorctgtgikuvgtu
41/%/2vq41/%/2
$cpm #fftguueqorctgtgikuvgtu
41/%/2vq41/%/2
$cpm #fftguuuwduvkvwvkqp tgikuvgtu
41/57$.*
$cpm #fftguuuwduvkvwvkqp tgikuvgtu
41/57$.*
$cpm #fftguuuwduvkvwvkqp tgikuvgtu
41/57$.*
$cpm #fftguuuwduvkvwvkqp tgikuvgtu
41/57$.*
$cpm #fftguuuwduvkvwvkqp tgikuvgtu
41/57$.*
page 190 2007-10-15 tmp91fw60 11.2 sfr descriptions the program patch logic consists of six banks (0 to 5). e ach bank is provided with th ree bytes of address compare registers (romcmpx0 to romcmpx2) and two bytes of address substitution regi sters (romsubxl and rom- subxh). note 1: the romcmp00/01/02, and romsub0l/0h regist ers do not support read-modify-write operation. note 2: bit0 of the address compare register 0 is read as undefined. bank0 address compare register 0 76543210 romcmp00 (0400h) rmw instructions are prohib- ited. bit symbol romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? read/write w ? after reset0000000 ? function target rom address (lower 7 bits) ? bank0 address compare register 1 76543210 romcmp01 (0401h) rmw instructions are prohib- ited. bit symbol romc15 romc14 romc13 ro mc12 romc11 romc10 romc09 romc08 read/write w after reset00000000 function target rom address (middle 8 bits) bank0 address compare register 2 76543210 romcmp02 (0402h) rmw instructions are prohib- ited. bit symbol romc23 romc22 romc21 ro mc20 romc19 romc18 romc17 romc16 read/write w after reset00000000 function target rom address (upper 8 bits) bank0 data substitution register l 76543210 romsub0l (0404h) rmw instructions are prohib- ited. bit symbol roms07 roms06 roms05 ro ms04 roms03 roms02 roms01 roms00 read/write w after reset00000000 function patch code (lower 8 bits) bank0 data substitution register h 76543210 romsub0h (0405h) rmw instructions are prohib- ited. bit symbol roms15 roms14 roms13 ro ms12 roms11 roms10 roms09 roms08 read/write w after reset00000000 function patch code (upper 8 bits)
page 191 2007-10-15 tmp91fw60 note 1: the romcmp10/11/12, and romsub1l/1h registers do not support read-modify-write operation. note 2: bit0 of the address compare register 0 is read as undefined. bank1 address compare register 0 76543210 romcmp10 (0408h) rmw instructions are prohib- ited. bit symbol romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? read/write w ? after reset0000000 ? function target rom address (lower 7 bits) ? bank1 address compare register 1 76543210 romcmp11 (0409h) rmw instructions are prohib- ited. bit symbol romc15 romc14 romc13 ro mc12 romc11 romc10 romc09 romc08 read/write w after reset00000000 function target rom address (middle 8 bits) bank1 address compare register 2 76543210 romcmp12 (040ah) rmw instructions are prohib- ited. bit symbol romc23 romc22 romc21 ro mc20 romc19 romc18 romc17 romc16 read/write w after reset00000000 function target rom address (upper 8 bits) bank1 data substitution register l 76543210 romsub1l (040ch) rmw instructions are prohib- ited. bit symbol roms07 roms06 roms05 ro ms04 roms03 roms02 roms01 roms00 read/write w after reset00000000 function patch code (lower 8 bits) bank1 data substitution register h 76543210 romsub1h (040dh) rmw instructions are prohib- ited. bit symbol roms15 roms14 roms13 ro ms12 roms11 roms10 roms09 roms08 read/write w after reset00000000 function patch code (upper 8 bits)
page 192 2007-10-15 tmp91fw60 note 1: the romcmp20/21/22, and romsub2l/2h regist ers do not support read-modify-write operation. note 2: bit0 of the address compare register 0 is read as undefined. bank2 address compare register 0 76543210 romcmp20 (0410h) rmw instructions are prohib- ited. bit symbol romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? read/write w ? after reset0000000 ? function target rom address (lower 7 bits) ? bank2 address compare register 1 76543210 romcmp21 (0411h) rmw instructions are prohib- ited. bit symbol romc15 romc14 romc13 ro mc12 romc11 romc10 romc09 romc08 read/write w after reset00000000 function target rom address (middle 8 bits) bank2 address compare register 2 76543210 romcmp22 (0412h) rmw instructions are prohib- ited. bit symbol romc23 romc22 romc21 ro mc20 romc19 romc18 romc17 romc16 read/write w after reset00000000 function target rom address (upper 8 bits) bank2 data substitution register l 76543210 romsub2l (0414h) rmw instructions are prohib- ited. bit symbol roms07 roms06 roms05 ro ms04 roms03 roms02 roms01 roms00 read/write w after reset00000000 function patch code (lower 8 bits) bank2 data substitution register h 76543210 romsub2h (0415h) rmw instructions are prohib- ited. bit symbol roms15 roms14 roms13 ro ms12 roms11 roms10 roms09 roms08 read/write w after reset00000000 function patch code (upper 8 bits)
page 193 2007-10-15 tmp91fw60 note 1: the romcmp30/31/32, and romsub3l/3h regist ers do not support read-modify-write operation. note 2: bit0 of the address compare register 0 is read as undefined. bank3 address compare register 0 76543210 romcmp30 (0418h) rmw instructions are prohib- ited. bit symbol romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? read/write w ? after reset0000000 ? function target rom address (lower 7 bits) ? bank3 address compare register 1 76543210 romcmp31 (0419h) rmw instructions are prohib- ited. bit symbol romc15 romc14 romc13 ro mc12 romc11 romc10 romc09 romc08 read/write w after reset00000000 function target rom address (middle 8 bits) bank3 address compare register 2 76543210 romcmp32 (041ah) rmw instructions are prohib- ited. bit symbol romc23 romc22 romc21 ro mc20 romc19 romc18 romc17 romc16 read/write w after reset00000000 function target rom address (upper 8 bits) bank3 data substitution register l 76543210 romsub3l (041ch) rmw instructions are prohib- ited. bit symbol roms07 roms06 roms05 ro ms04 roms03 roms02 roms01 roms00 read/write w after reset00000000 function patch code (lower 8 bits) bank3 data substitution register h 76543210 romsub3h (041dh) rmw instructions are prohib- ited. bit symbol roms15 roms14 roms13 ro ms12 roms11 roms10 roms09 roms08 read/write w after reset00000000 function patch code (upper 8 bits)
page 194 2007-10-15 tmp91fw60 note 1: the romcmp40/41/42, and romsub4l/4h regist ers do not support read-modify-write operation. note 2: bit0 of the address compare register 0 is read as undefined. bank4 address compare register 0 76543210 romcmp40 (0420h) rmw instructions are prohib- ited. bit symbol romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? read/write w ? after reset0000000 ? function target rom address (lower 7 bits) ? bank4 address compare register 1 76543210 romcmp41 (0421h) rmw instructions are prohib- ited. bit symbol romc15 romc14 romc13 ro mc12 romc11 romc10 romc09 romc08 read/write w after reset00000000 function target rom address (middle 8 bits) bank4 address compare register 2 76543210 romcmp42 (0422h) rmw instructions are prohib- ited. bit symbol romc23 romc22 romc21 ro mc20 romc19 romc18 romc17 romc16 read/write w after reset00000000 function target rom address (upper 8 bits) bank4 data substitution register l 76543210 romsub4l (0424h) rmw instructions are prohib- ited. bit symbol roms07 roms06 roms05 ro ms04 roms03 roms02 roms01 roms00 read/write w after reset00000000 function patch code (lower 8 bits) bank4 data substitution register h 76543210 romsub4h (0425h) rmw instructions are prohib- ited. bit symbol roms15 roms14 roms13 ro ms12 roms11 roms10 roms09 roms08 read/write w after reset00000000 function patch code (upper 8 bits)
page 195 2007-10-15 tmp91fw60 note 1: the romcmp50/51/52, and romsub5l/5h regist ers do not support read-modify-write operation. note 2: bit0 of the address compare register 0 is read as undefined. bank5 address compare register 0 76543210 romcmp50 (0428h) rmw instructions are prohib- ited. bit symbol romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? read/write w ? after reset0000000 ? function target rom address (lower 7 bits) ? bank5 address compare register 1 76543210 romcmp51 (0429h) rmw instructions are prohib- ited. bit symbol romc15 romc14 romc13 ro mc12 romc11 romc10 romc09 romc08 read/write w after reset00000000 function target rom address (middle 8 bits) bank5 address compare register 2 76543210 romcmp52 (042ah) rmw instructions are prohib- ited. bit symbol romc23 romc22 romc21 ro mc20 romc19 romc18 romc17 romc16 read/write w after reset00000000 function target rom address (upper 8 bits) bank5 data substitution register l 76543210 romsub5l (042ch) rmw instructions are prohib- ited. bit symbol roms07 roms06 roms05 ro ms04 roms03 roms02 roms01 roms00 read/write w after reset00000000 function patch code (lower 8 bits) bank5 data substitution register h 76543210 romsub5h (042dh) rmw instructions are prohib- ited. bit symbol roms15 roms14 roms13 ro ms12 roms11 roms10 roms09 roms08 read/write w after reset00000000 function patch code (upper 8 bits)
page 196 2007-10-15 tmp91fw60 11.3 operation 11.3.1 replacing data two consecutive bytes of data can be replaced for each bank. a two-byte sequence to be replaced must start at an even address. if only a sing le byte at an even or odd address n eed be replaced, set the current masked rom data in the other byte. correction procedure: load the address compare registers (romcmp00 to romcmp02) with the target address where rom data need be replaced. store 2-byte patch code in the romsub0l and romsub0h registers. when the cpu address matches the value stored in the romcmp00 to romcmp02 registers, the program patch logic disables rd output to the masked rom and drives out the code stored in the romsub0l and romsub0h to the internal bus. the cpu thus fetches the patch code. the following shows some examples: figure 11-2 example patch code implementation a. replacing 00h at address ff1230h with aah 76543210 romcmp00 0 0 1 1 0 0 0 0 stores 30 in address compare register 0 for bank0. romcmp01 0 0 0 1 0 0 1 0 stores 12 in address compare register 1 for bank0. romcmp02 1 1 1 1 1 1 1 1 stores ff in address compare register 2 for bank0. romsub0l 1 0 1 0 1 0 1 0 store aa in address substitution register low for bank0. romsub0h 0 0 0 1 0 0 0 1 store 11 in address substitution register high for bank0. 1pejkr rgtkrjgtcn 1pejkr4#/ 'zvgtpcnctgc 00h 11h 8gevqtvcdng ff1230h ff1231h replace with aah replace with 11h (same as current value). ffffffh c fe0000h 001000h 000000h 1pejkr41/
page 197 2007-10-15 tmp91fw60 figure 11-3 example patch code implementation figure 11-4 example patch code implementation b. replacing 33h at address ff1233h with bbh 76543210 romcmp00 0 0 1 1 0 0 1 0 stores 32 in address compare register 0 for bank0. romcmp01 0 0 0 1 0 0 1 0 stores 12 in address compare register 1 for bank0. romcmp02 1 1 1 1 1 1 1 1 stores ff in address compare register 2 for bank0. romsub0l 0 0 1 0 0 0 1 0 store 22 in address substitution register low for bank0. romsub0h 1 0 1 1 1 0 1 1 store bb in address substitution register high for bank0. c. replacing 44h at address ff1234h with cch and 55h at address ff1235h with ddh 76543210 romcmp00 0 0 1 1 0 1 0 0 stores 34 in address compare register 0 for bank0. romcmp01 0 0 0 1 0 0 1 0 stores 12 in address compare register 1 for bank0. romcmp02 1 1 1 1 1 1 1 1 stores ff in address compare register 2 for bank0. romsub0l 1 1 0 0 1 1 0 0 store cc in address substitution register low for bank0. romsub0h 1 1 0 1 1 1 0 1 store dd in address substitution register high for bank0. ff1232h ff1233h ffffffh d fe0000h 001000h 000000h 1pejkr rgtkrjgtcn 1pejkr4#/ 'zvgtpcnctgc 00h 11h 8gevqtvcdng 1pejkr41/ replace with 22h (same as current value). replace with bbh ff1234h ff1235h ffffffh e fe0000h 001000h 000000h 1pejkr rgtkrjgtcn 1pejkr4#/ 'zvgtpcnctgc 00h 11h 8gevqtvcdng 1pejkr41/ replace with cch replace with ddh
page 198 2007-10-15 tmp91fw60 figure 11-5 example patch code implementation d. replacing 77h at address ff1237h with eeh and 88h at address ff1238h with ffh (requiring two banks) 76543210 romcmp00 0 0 1 1 0 1 1 0 stores 36 in address compare register 0 for bank0. romcmp01 0 0 0 1 0 0 1 0 stores 12 in address compare register 1 for bank0. romcmp02 1 1 1 1 1 1 1 1 stores ff in address compare register 2 for bank0. romsub0l 0 1 1 0 0 1 1 0 store 66 in address substitution register low for bank0. romsub0h 1 1 1 0 1 1 1 0 store ee in address substitution register high for bank0. romcmp10 0 0 1 1 1 0 0 0 stores 38 in address compare register 0 for bank1. romcmp11 0 0 0 1 0 0 1 0 stores 12 in address compare register 1 for bank1. romcmp12 1 1 1 1 1 1 1 1 stores ff in address compare register 2 for bank1. romsub1l 1 1 1 1 1 1 1 1 store ff in address substitution register low for bank1. romsub1h 1 0 0 1 1 0 0 1 store 99 in address substitution register high for bank1. 66h 77h 88h 99h ff1236h ff1237h ff1238h ff1239h ffffffh f fe0000h 001000h 000000h 1pejkr rgtkrjgtcn 1pejkr4#/ 'zvgtpcnctgc 8gevqtvcdng 1pejkr41/ replace with 66h (same as current value). replace with eeh replace with ffh replace with 99h (same as current value).
page 199 2007-10-15 tmp91fw60 11.3.2 using an interrupt to cause a branch a wider range of program code can also be fixed using a software interrupt (swi). with a patch code loaded into on-chip ram, the progra m patch logic can be used to replace progr am code at a specified address with a single-byte swi instruction, which causes a branch to the patch program. note that this method can only be used if the original masked rom has been developed with on-chip ram addresses specified as swi vector addresses. correction procedure: load the address compare registers (romcmp00 to romcmp02) with the start address of the program code that is to be fixed. if it is an even address, store an swi instruction code (e.g., swi:f9h) in the rom- subl. if the start address is an odd address, store an swi instruction code in the romsubh and the current rom data at the preceding ev en address in the romsubl. when the cpu address matches the value stored in the romcmp00 to romcmp02 registers, the program patch logic disables rd output to the masked rom and drives out the swi instruction code to the internal bus. upon fetching the swi code, the cpu makes a branch to the internal ram area to ex ecute the preloaded code. at the end of the patch program executed from the in ternal ram, the cpu directly rewrites the saved pc value so that it points to the address follow ing the patch code, and then executes a reti. the following shows an example: example: fixing a program within the range from ff5000h to ff507fh before developing the original masked rom, set the swi1 vector reference address to 001500h (on- chip ram area). use the startup routine to load the patch code to on-chip ram (001500h to 0015efh). store the start address (ff5000h) of the rom area to be fixed in the romcmp00 to romcmp02. store the swi1 instruction code (f9h) in the romsub0l and the current data at ff5001h (aah) in the romsub0h. when the cpu address matches the value stored in romcmp00 to romcmp02, the program patch logic replaces the rom-based code at ff5000h with f9h. the cpu then executes the swi1 instruction, which causes a branch to 001500h in the on-chip ram area. after executing the patch program the cpu finally rewrites the saved pc value to ff5080h and executes a reti.
page 200 2007-10-15 tmp91fw60 figure 11-6 exam ple rom correction 1pejkr rgtkrjgtcn 1pejkr4#/ 'zvgtpcnctgc 1pejkr41/ 55h aah sw1 xgevqt (((* ((* replace the start address with f9h (swi1 instruction code). replace with aah (same as current value). &ghgevkxg ctgc ('* * * ((* ((* ((((* :* ((((* ((((* 8gevqtvcdng 001500h 2cvej rtqitco * n n n n * '(* 2tqitcodqf[ n n n n 4gytkvguvcem reti * '(* 4gvwtphtqo+06 $tcpejecwugfd[59
page 201 2007-10-15 tmp91fw60 12. watchdog timer (runaway detection timer) the tmp91fw60 features a watchdog timer for detecting runaway. the watchdog timer (wdt) is used to return the cpu to normal state when it detects that the cpu has started to malfunction (runaway) due to causes such as noise. when the watchdog timer detects a malfunction, it gene rates a non-maskable interrupt intwd to notify the cpu. connecting the watchdog timer output to the reset pin internally forces a reset.(the level of external reset pin is not changed) 12.1 configuration figure 12-1 is a block diagram of he watchdog timer (wdt). figure 12-1 block diagr am of watchdog timer note: it needs to care designing the total machine set, bec ause watchdog timer can?t operate completely by external noise. binary counter (22 stages) intwd interrupt reguest wdmod wdmod wdmod internal reset internal reset write 4eh write b1h q r s selector reset 2 15 wdt control register wdcr f sys (f fph /2) 2 17 2 19 2 21 reset reset control internal data bus
page 202 2007-10-15 tmp91fw60 12.2 operation the watchdog timer generates an intwd interrupt when the detection time set in the wdmod has elapsed. the watchdog timer must be cleared ?0? by software before an intwd interrupt will be generated. if the cpu malfunctions (e.g., if runaway occu rs) due to causes such as noise, but does not execute the instruction used to clear the binary counter, the binary co unter will overflow and an intwd interrupt will be generated. the cpu will detect malfunction (runaway) due to the intwd interrupt and in this case it is possible to return to the cpu to nor- mal operation by means of an anti-malfunction program. the watchdog timer works immediately after reset. the watchdog timer does not operate in idle1 or stop mode. when the device is in idle2 mode, the operation of wdt depends on the wdmod setting. ensure that wdmod is set before the device enters idle2 mode. the watchdog timer consists of a 22-stage bina ry counter which uses the system clock (f sys ) as the input clock. the binary counter can output f sys /2 15 , f sys /2 17 , f sys /2 19 and f sys /2 21 . figure 12-2 normal mode the runaway is detected when an overflow occurs, and the watchdog timer can reset this device. in this case, the reset time will be between 22 and 29 states (51.2 s at f osch = 20 mhz) as shown in figure 12-3. after a reset, the f sys clock (1 cycle = 1 state) is f fph /2, where f fph is generated by dividing the high-speed oscillator clock (f osch ) by sixteen through the clock gear function. figure 12-3 reset mode n overflow 0 wdt counter wdt clear (software) wdt interrupt write clear code n overflow wdt counter internal reset wdt interrupt 22 to 29 states  (26.1 to 34.4 s at f osch = 27 mhz, f fph = 1.7 mhz)
page 203 2007-10-15 tmp91fw60 12.3 control registers the watchdog timer wdt is controlled by two control registers wdmod and wdcr. 12.3.1 watchdog timer mode register (wdmod) a. setting the detection time for the watchdog timer in this 2-bit register is used for setting the watch dog timer interrupt time used when detecting run- away. after reset, this register is initialized to wdmod = ?00?(2 15 / f sys [s]). b. watchdog timer enable/disab le control register after reset, wdmod is initialized to ?1?, enabling the watchdog timer. to disable the watchdog timer, it is necessary to set this bit to ?0? and to write the disable code (b1h) to the watchdog timer control register wdcr. this makes it difficult for the watchdog timer to be disabled by runaway. however, it is possible to return the watchdog timer from the disabled state to the enabled state merely by setting to ?1?. c. watchdog timer out reset connection this register is used to connect the output of the watchdog timer with the internal reset. since wdmod is initialized to ?0? on reset, a reset by the watchdog timer will not be per- formed. 12.3.2 watchdog timer c ontrol register (wdcr) this register is used to disable and clear the binary counter for the watchdog timer. ? disable control the watchdog timer can be disabled by clearin g wdmod to ?0? and then writing the disable code (b1h) to the wdcr register. ? enable control set wdmod to ?1?. ? watchdog timer clear control to clear the binary counter and cause counting to resume, write th e clear code (4 eh) to the wdcr register. wdmod 0 ? ? x x ? ? 0 clear wdmod to ?0?. wdcr 1 0 1 1 0 0 0 1 write the disable code (b1h). wdcr 01001110 write the clear code (4eh).
page 204 2007-10-15 tmp91fw60 watchdog timer mode register 76543210 wdmod (0300h) bit symbol wdte wdtp1 wdtp0 ? ? i2wdt rescr ? read/write r/w r/w ? ? r/w r/w after reset100??000 function wdt control 1: enable select detecting time 00: 2 15 /f sys 01: 2 17 /f sys 10: 2 19 /f sys 11: 2 21 /f sys idle2 control reset control always write ?0?. watchdog timer out control rescr 0? 1 connect wdt out to a internal reset idle2 control i2wdt 0stop 1 operation watchdog timer detection time @fc = 20 mhz, fs = 32.768 khz syscr1 system clock selection syscr1 gear value watchdog timer detection time wdmod 00 01 10 11 1(fs) xxx 2.0 s 8.0 s 32.0 s 128.0 s 0(fc) 000 (fc) 3.28 ms 13.11 ms 52.43 ms 209.72 ms 001 (fc/2) 6.55 ms 26.21 ms 104.86 ms 419.43 ms 010(fc/4) 13.11 ms 52.43 ms 209.72 ms 838.86 ms 011 (fc/8) 26.21 ms 104.86 ms 419.43 ms 1677.72 ms 100 (fc/16) 52.43 ms 209.72 ms 838.86 ms 3355.44 ms watchdog timer enable/disable control wdte 0 disabled 1 enabled watchdog timer control register 76543210 wdcr (0301h) rmw instructions are prohib- ited. bit symbol - read/write w after reset - function b1h: wdt disable code 4eh: wdt clear code disable/clear wdt b1h disable code 4eh clear code others don?t care
page 205 2007-10-15 tmp91fw60 13. special timer for clock the tmp91fw60 includes a timer that is used for a clock operation. an interrupt (intrtc) can be generated each 0.0625 [s] or 0.125 [s] or 0.25 [s] or 0.50 [s] by using a low fre- quency clock of 32.768 khz. a clock function can be easily used. in addition, intrtc can return from each standby mode except stop mode. a special timer for clock can operate in all mode s in which a low-frequency oscillation is operated. the special timer for clock is contro lled by the special timer for clock co ntrol register (rtccr) as shown in. 13.1 configuration figure 13-1 blo ck diagram for special timer for clock special timer for clock control register 76543210 rtccr (0310h) bit symbol ????? rtcsel1 rtcsel0 rtcrun read/write r/w ???? r/w r/w after reset 0 ???? 000 function always write ?0?. ???? 00: 2 14 /fs 01: 2 13 /fs 10: 2 12 /fs 11: 2 11 /fs 0: stop & clear 1: count counting operation 0 stop & clear 1 count interrupt generation cycle (fs = 32.768 khz) 00 0.50 s 11 0.25 s 10 0.125 s 11 0.0625 s interrupt request intrtc fs (32.768 khz) run/ clear 2 11 rtccr rtccr 2 12 2 13 2 14 14-stage binary counter selector
page 206 2007-10-15 tmp91fw60 14. flash memory the tmp91fw60 incorporates flash memo ry that can be electrically erased and programmed using a single 5v power supply. the flash memory is programmed and erased using je dec-standard commands. after a program or erase com- mand is input, the corresponding operation is automatically performed internally. erase operations can be performed by the entire chip (chip erase) or on a sector basis (sector erase). the configuration and oper ations of the flash memory are described below. 14.1 features 14.2 block diagram figure 14-1 block diagram of flash memory unit power supply voltage for program/erase operations sector size - vcc = 4.75 to 5.25 v - 8kbytes 16 (t opr = -10 to 40 c, fc = 4 to 20mhz) mode control configuration - jede c-standard commands - 64k 16 bits (128 k bytes) programming method functions - on-board programming - single-word programming - parallel programmer - chip erase security - sector erase - write protection - data polling / toggle bit - read protection +pvgtpcncfftguudwu 41/ eqpvtqnngt  oqfg eqpvtqn  oqfg ugvvkpirkp %qpvtqn  &cvc (ncujogoqt[ %qnwopfgeqfgt5gpugcor  &cvcncvej  #fftguuncvej  'tcugugevqtfgeqfgt  %qpvtqn ektewkv
kpenwfkpi cwvqocvke ugswgpeg eqpvtqn ektewkv %qoocpf tgikuvgt          (ncujogoqt[egnnu    -$     4qyfgeqfgt  #fftguu +pvgtpcnfcvcdwu +pvgtpcneqpvtqndwu
page 207 2007-10-15 tmp91fw60 14.3 operation modes 14.3.1 overview the following three types of operation modes are availa ble to control program/erase operations on the flash memory. of the modes listed in table 14-1, the internal flash memory can be pr ogrammed in user boot mode, single boot mode and programmer mode. the mode in which the flash memory can be programmed/erased while mounted on the user board is defined as the on-board programming mode. of the modes listed above, single boot mode and user boot mode are classified as on-board programming modes. single bo ot mode supports toshiba's proprietary programming/ erase method using serial i/o. user boot mode (withi n single chip mode) allows the flash memory to be pro- grammed/erased by a user-specified method. programmer mode is provided with a read protect function which prohibits reading of rom data. by enabling the read protect function upon completion of programming, the user can protect rom data from being read by third parties. table 14-1 description of operation modes operation mode name description single chip mode after reset release, the device starts up from the internal flash memory. single chip mode is further divided into two m odes: ?normal mode? is a mode in which user application programs are executed, and ?user boot mode? is used to program the flash memory on-board. the means of switching between these two modes can be set by the user as desired. for exam- ple, it can be set so that port 00 = '1' selects normal mode and port 00 = '0' selects user boot mode. the user must include a routine to handle mode switching in a user application program. normal mode in this mode, the device starts up from a user application program. user boot mode in this mode, the flash memory can be programmed by a user-specified method. single boot mode after reset release, the device starts up from the internal boot rom (mask rom). the boot rom includes an algorithm which allows a pr ogram for programming/erasing the flash memory on-board via a serial port to be transferred to the device's internal ram. the transferred pro- gram is then executed in the internal ram so that the flash memory can be programmed/erased by receiving data from an external host and issuing program/erase commands. programmer mode this mode enables the internal flash memory to be programmed/erased using a general-pur- pose programmer. for programmers that can be us ed, please contact your local toshiba sales representative.
page 208 2007-10-15 tmp91fw60 the operation mode single chip mode, single boot m ode or programmer mode is determined during reset by externally setting the input levels on the am0, am1 and boot (emu0) pins. except in programmer mode which is entered with reset held at ?0?, the cpu will start operating in the selected mode after the reset state is released. once the operati on mode has been set, make sure that the input levels on the mode setting pins are not changed during operation.table 14-2 shows how to set each operation mode, and figure 14-2 shows a mode transition diagram. note:although emu0 is an output pin, it becomes an input pi n with pull-up resistor only during a reset. after a reset, emu0 operates as follows depending on the operation mode. >single chip mode : output pin with pull-up resistor >single boot mode : pull-up (input gate is invalid, and output gate is in high impedance.) note: numbers in ( ) correspond to the operation mode pin settings shown in table 14-2. figure 14-2 mode transition diagram 14.3.2 reset operation to reset the device, hold the reset input at ?0? for at least 10 system clocks while the power supply voltage is within the rated operating voltage range and the inte rnal high-frequency oscillator is oscillating stably. for details, refer to ?reset of cpu?. table 14-2 operation mode pin settings operation mode input pins reset boot (emu0) am1 am0 (1) single chip mode (normal or user boot mode) rising edge open 1 1 (2) single boot mode 0 1 1 (3) programmer mode 0 - 1 0 1pdqctfrtqitcookpi  oqfg  4'5'6  4'5'6 
 
 
  5ykvejkpiogvjqf vqdgugvd[wugt  5kpingejkroqfg  4gugvuvcvg 
 qt
  9  4'5'6  0qtocnoqfg  7ugt$qqv oqfg  5kping$qqv  oqfg  2tqitcoogt oqfg
page 209 2007-10-15 tmp91fw60 14.3.3 memory map for each operation mode in this product, the memory map varies with operatio n mode. the memory map and sector address ranges for each operation mode are shown below. figure 14-3 memory map for each operation mode  *  *  ((((((*    4gugtxgf   *  *  *  ('*  ((((*  ((((((*  +pvgtpcn+1 +pvgtpcn 4#/ -$   'zvgtpcnogoqt[ +pvgtpcn (ncuj41/ -$  
+pvgttwrvxgevqt$  (((*  *  *  *  *   ((((*  ((((((*  *
m &?   ]+? (ncuj41/  +pvgtpcn +1   'zvgtpcnogoqt[ 'zvgtpcnogoqt[ +pvgtpcn$qqv41/  -$   
+pvgttwrvxgevqt$  +pvgtpcn (ncuj41/ -$ +pvgtpcn (ncuj41/ -$ +pvgtpcn 4#/ -$ 5kping%jkroqfg 5kping$qqvoqfg 2tqitcookpioqfg
page 210 2007-10-15 tmp91fw60 table 14-3 sector address ranges for each operation mode single chip mode single boot mode sector-0 fe0000h to fe1fffh 10000h to 11fffh sector-1 fe2000h to fe3fffh 12000h to 13fffh sector-2 fe4000h to fe5fffh 14000h to 15fffh sector-3 fe6000h to fe7fffh 16000h to 17fffh sector-4 fe8000h to fe9fffh 18000h to 19fffh sector-5 fea000h to febfffh 1a000h to 1bfffh sector-6 fec000h to fedfffh 1c000h to 1dfffh sector-7 fee000h to feffffh 1e000h to 1ffffh sector-8 ff0000h to ff1fffh 20000h to 21fffh sector-9 ff2000h to ff3fffh 22000h to 23fffh sector-10 ff4000h to ff5fffh 24000h to 25fffh sector-11 ff6000h to ff7fffh 26000h to 27fffh sector-12 ff8000h to ff9fffh 28000h to 29fffh sector-13 ffa000h to ffbfffh 2a000h to 2bfffh sector-14 ffc000h to ffdfffh 2c000h to 2dfffh sector-15 ffe000h to ffffffh 2e000h to 2ffffh
page 211 2007-10-15 tmp91fw60 14.4 single boot mode in single boot mode, the internal boot rom (mask rom) is activated to transfer a program/erase routine (user- created boot program) from an external source into the inte rnal ram. this program/erase routine is then used to pro- gram/erase the flash memory. in this mode, the internal boot rom is mapped into an area containing the interrupt vector table, in which the boot rom pr ogram is executed. the flash memory is mapped into an address space differ- ent from the one into which the boot rom is mapped (see figure 14-3). the device's sio (sio1) and the contro ller are connected to transfer the pr ogram/erase routine from the controller to the device's internal ram. this pr ogram/erase routine is then executed to program/erase the flash memory. the program/erase routine is executed by sending commands and write data from the controller. the communications protocol between the device and the controller is describe d later in this manual. before the program/erase routine can be transferred to the ram, user passwor d verification is performed to ensure the security of user rom data. if the password is not verified co rrectly, the ram transfer operation cannot be performed. in single boot mode, disable interrupts and use the interrupt request fl ags to check for an interrupt request. note: do not change to another operation mode in the program/erase routine.
page 212 2007-10-15 tmp91fw60 14.4.1 using the program/e rase algorithm in t he internal boot rom (step-1)environment setup since the program/erase routine and write data are transferred via si o (sio1), connect the device's sio (sio1) and the controller on the board. the user must prepare the program/erase routine (a) on the con- troller. (step-2) starting up the internal boot rom release the reset with the relevant input pins set for entering single boot mode. when the internal boot rom starts up, the program/erase rout ine (a) is transferred from the cont roller to the internal ram via sio according to the communications proced ure for single boot mode. before th is can be carried out, the password entered by the user is verified against the password writt en in the user application program. (if the flash mem- ory has been erased, 12 bytes of ? 0xff? are used as the password.) 
6/2(9 (ncujogoqt[  4#/      1nfwugtcrrnkecvkqp rtqitco
qtgtcugfuvcvg 
+1  $qqv41/  5+1 
%qpvtqnngt  0gywugt crrnkecvkqp rtqitco  
c 2tqitcogtcugtqwvkpg  
6/2(9

+1  4'5'6  %qpfkvkqphqt gpvgtkpi5kping $qqvoqfg        4#/      5+1  (ncujogoqt[ 1nfwugtcrrnkecvkqp rtqitco
qtgtcugfuvcvg $qqv41/ %qpvtqnngt 0gywugt crrnkecvkqp rtqitco
c 2tqitcogtcugtqwvkpg
page 213 2007-10-15 tmp91fw60 (step-3) copying the progra m/erase routine to the ram after password verification is completed, the boot rom copies the program/erase routine (a) from the con- troller to the ram using serial communications. the pr ogram/erase routine must be stored within the ram address range of 001000h to 002dffh. (step-4) executing the progra m/erase routine in the ram control jumps to the program/erase routine (a) in the ram. if necessary, the old user application program is erased (sector erase or chip erase). note 1: the boot rom is provided with an erase command, which enables the entire chip to be erased from the controller without using the program/erase routine. note 2: if it is necessary to erase data on a sector basis, incorporate the necessary code in the program/erase rou- tine. 
6/2(9  4#/      

+1       5+1 
c 2tqitcogtcugtqwvkpg   %qpvtqnngt 0gywugt crrnkecvkqp rtqitco
c 2tqitcogtcugtqwvkpg (ncujogoqt[ 1nfwugtcrrnkecvkqp rtqitco
qtgtcugfuvcvg $qqv41/ 
6/2(9   4#/ 

+1       5+1 
c 2tqitcogtcugtqwvkp g  'tcugf  (ncujogoqt[ $qqv41/ %qpvtqnngt 0gywugt crrnkecvkqp rtqitco
c 2tqitcogtcugtqwvkpg
page 214 2007-10-15 tmp91fw60 (step-5) copying the new user application program the program/erase routine (a) loads th e new user application program from the controller into the erased area of the flash memory. in the example below, the new user application program is transferred under the same communications con- ditions as those used for transferring the program/erase routine. however, after the program/erase routine has been transferred, this routine can be used to change th e transfer settings (data bus an d transfer source). config- ure the board hardware and program/erase routine as desired. (step-6) executing the new user application program after the programming operation has been completed, tu rn off the power to the board and remove the cable connecting the device and the controll er. then, turn on the power again and start up the device in single chip mode to execute the new user application program. 
6/2(9  4#/  0gywugtcrrnkecvkqp rtqitco    

+1      5+1   %qpvtqnngt 0gywugt crrnkecvkqp rtqitco
c 2tqitcogtcugtqwvkpg
c 2tqitcogtcugtqwvkpg (ncujogoqt[ $qqv41/ 
6/2(9 
4'5'6  %qpfkvkqphqt gpvgtkpi5kping %jkroqfg
0qtocnoqfg      4#/        5+1  0gywugtcrrnkecvkqp rtqitco (ncujogoqt[ $qqv41/ %qpvtqnngt
page 215 2007-10-15 tmp91fw60 14.4.2 connection examples for single boot mode in single boot mode the flash memory is programme d by serial transfer. therefore, on-board programming is performed by connecting the device's sio (sio1) a nd the controller (programming tool) and sending com- mands from the controller to the device. figure 14-4 shows an example of connection between the target board and a programming controller. figure 14-5 shows an example of connection between the target board and an rs232c board. figure 14-4 example of connection with an external c ontroller in single boot mode &8%% 8%% 45% 41/ /qfgeqpvtqn 2tqitco eqpvtqnngt 8%%  8%% 4gi 1p$qctf2tqitcookpi%qpvtqnngt 4'5'6 $116 /%7 6ctigvdqctf qrgtcvkqp 4'5'6 $116
'/7 4#/ 6/2(9 #/ #/ 2% 855 &855 2 2 6:&
2 4:&
2 4:& 6:& 2 2 2qygt uwrrn[ $qqv oqfg uykvejkpi ektewkv 6ctigv$qctf /qfgeqpvtqn
page 216 2007-10-15 tmp91fw60 figure 14-5 example of c onnection with an rs232c b oard in single boot mode 6ctigv$qctf  &8%% 8%% 45% 8%%  8%% 2qygt uwrrn[ 45% $qctf 4'5'6 $116 4'5'6 $qqv oqfg uykvejkpi ektewkv $116
'/7 6/2(9 #/ #/ 2% 855 &855 6:&
2 4:&
2 4:& 6:& 855
page 217 2007-10-15 tmp91fw60 14.4.3 mode setting to perform on-board programming, the device must be started up in single boot mode by setting the input pins as shown below. am0,am1= 1 boot = 0 reset = 0 1 set the am0, am1, and boot pins as shown above with the reset pin held at ?0?. then, setting the reset pin to ?1? will start up the device in single boot mode. 14.4.4 memory maps figure 14-6 shows a comparison of the memory map for normal mode (in single chip mode) and the mem- ory map for single boot mode. in single boot mode, the flash memory is mapped to addresses 10000h to 2ffffh (physical addresses) and the boot rom (mask rom) is mapped to addresses fff000h to ffffffh. figure 14-6 comparison of memory maps 5kping%jkroqfg 5kping$qqvoqfg 000000h 001000h 003000h fe0000h ffff00h ffffffh fff000h 000000h 001000h 010000h 030000h ffff00h ffffffh 003000h (
m&? ) ]+? flash rom internal i/o internal ram 8kb external memory internal flash rom 128kb internal i/o internal ram 8kb external memory external memory internal boot rom 4kb internal flash rom 128kb (interrupt vector 256b) (interrupt vector 256b)
page 218 2007-10-15 tmp91fw60 14.4.5 interface specifications the sio communications format in single boot mode is shown below. the device supports the uart (asyn- chronous communications) serial operation mode. to perform on-board programming, the same communi cations format must also be set on the programming controller's side. note: unused pins are in the initial state after reset release. uart (asynchronous) communications - communications channel : sio channel 1(for the pins be used, see table 14-4 ) - serial transfer mode : uart (asynchronous communications) mode - data length : 8 bits - parity bit : none - stop bit : 1 bit - baud rate : see table 14-5 , table 14-6 table 14-4 pin connections pins uart power sup- ply pins dvcc dvss mode set- ting pins am1,am0 boot reset pin reset communi- cations pins txd1 rxd1 table 14-5 baud rate table sio transfer rate (bps) uart 115200 57600 38400 19200 9600
page 219 2007-10-15 tmp91fw60 reference frequency: the frequency of the high-speed oscillation circ uit that can be used in single boot mode. to program the flash memory using single boot mode, one of the reference frequencies must be selected as a high-speed clock. supported range: the range of clock frequencies that are detected as each reference frequency. it may not be possible to perform single boot operations at clock fr equencies outside of the supported range. note:to automatically detect the reference frequency (micro controller clock frequency), the transfer baud rate error of the flash memory programming controller and the oscillation frequency error must be within ?1.5 %, + 2% in total. table 14-6 correspondence betw een operating frequency and baud rate in single boot mode 115200 error (%) - - - - 0 - - - baud rate (bps) - - - - 115200 - - - 57600 error (%) - - - - 0 - 0 - baud rate (bps) - - - - 57600 - 57600 - 38400 error (%) - +1.73 - 0 0 - - +1.73 baud rate (bps) - 39063 - 38400 38400 - - 39063 19200 error (%) - +1.73 0 0 0 +0.16 0 +1.73 baud rate (bps) - 19531 19200 19200 19200 19231 19200 19531 9600 error (%) +0.16 +1.73 0 0 0 +0.16 0 +1.73 baud rate (bps) 9615 9766 9600 9600 9600 9615 9600 9766 reference baud rate (bps) supported range (mhz) 7.87 to 8.14 9.69 to 10.02 10.90 to 11.28 12.11 to 12.53 14.53 to 15.04 15.74 to 16.29 18.16 to 18.80 19.37 to 20.05 reference frequency (mhz) 8 10 11.0592 12.288 14.7456 16 18.4320 20
page 220 2007-10-15 tmp91fw60 14.4.6 data transfer formats table 14-7 to table 14-12 show the operation command data and the data transfer format for each operation mode. table 14-7 operation command data operation command data operation mode 10h ram transfer 20h flash memory sum 30h product information read 40h flash memory chip erase 60h flash memory protect set
page 221 2007-10-15 tmp91fw60 table 14-8 transfer format of single boot program [ram transfer] transfer byte number transfer data from controller to device baud rate transfer data from device to controller boot rom 1st byte baud rate setting uart 86h desired baud rate #1 #1 for the desired baud rate setting, see table 14-6 . - 2nd byte - ack response to baud rate setting normal (baud rate ok) >uart 86h (if the desired baud rate cannot be set, operation is terminated.) 3rd byte operation command data (10h) - 4th byte - ack response to operation command #2 normal 10h error x1h protection applied #3 x6h communications error x8h #2 after sending an error response, the device waits for operation command data (3rd byte). #3 when read protection or write protection is applied, the device aborts the received operation command and waits for the next operation command data (3rd byte). 5th byte to 16th byte password data (12 bytes) (02fef4h to 02feffh) - 17th byte checksum value for 5th to 16th bytes - 18th byte - ack response to checksum value #2 normal 10h error 11h communications error 18h 19th byte ram storage start address 31 to 24 #4 #4 the data to be transferred in the 19th to 25th bytes should be programmed within the ram address range of 001000h to 002dffh (7.5 kbytes). - 20th byte ram storage start address 23 to 16 #4 - 21th byte ram storage start address 15 to 8 #4 - 22th byte ram storage start address 7 to 0 #4 - 23th byte ram storage byte count 15 to 8 #4 - 24th byte ram storage byte count 7 to 0 #4 - 25th byte checksum value for 19th to 24th bytes #4 - 26th byte - ack response to checksum value #2 normal 10h error 11h communications error 18h 27th byte to (m)th byte ram storage data - (m+1)th byte checksum value for 27th to m'th bytes - (m+2)th byte - ack response to checksum value #2 normal 10h error 11h communications error 18h ram (m+3)th byte - jump to ram storage start address
page 222 2007-10-15 tmp91fw60 table 14-9 transfer format of single boot program [flash memory sum] transfer byte number transfer data from controller to device baud rate transfer data from device to controller boot rom 1st byte baud rate setting uart 86h desired baud rate #1 #1 for the desired baud rate setting, see table 14-6 . - 2nd byte - ack response to baud rate setting normal (baud rate ok) >uart 86h (if the desired baud rate cannot be set, operation is terminated.) 3rd byte operation command data (20h) - 4th byte - ack response to checksum value #2 normal 20h error x1h communications error x8h #2 after sending an error response, the device waits for operation command data (3rd byte). 5th byte - sum (upper) 6th byte - sum (lower) 7th byte - checksum value for 5th and 6th bytes 8th byte (wait for the next operation command data) -
page 223 2007-10-15 tmp91fw60 table 14-10 transfer format of single boot program [product information read](1/2) transfer byte number transfer data from controller to device baud rate transfer data from device to controller boot rom 1st byte baud rate setting uart 86h desired baud rate #1 - 2nd byte - ack response to baud rate setting normal (baud rate ok) >uart 86h (if the desired baud rate cannot be set, operation is terminated.) 3rd byte operation command data (30h) - 4th byte - ack response to operation command #2 normal 30h error x1h communications x8h 5th byte - flash memory data (address 02fef0h) 6th byte - flash memory data (address 02fef1h) 7th byte - flash memory data (address 02fef2h) 8th byte - flash memory data (address 02fef3h) 9th byte to 20th byte - part number (ascii code, 12 bytes) 'tmp91fw60 _ _ _ ' (from 9th byte) 21th byte to 24th byte - password comparison start address (4 bytes) f4h, feh, 02h, 00h (from 21st byte) 25th byte to 28th byte - ram start address (4 bytes) 00h, 10h, 00h, 00h (from 25th byte) 29th byte to 32th byte - ram (user area) end address (4 bytes) ffh, 2dh, 00h, 00h (from 29th byte) 33th byte to 36th byte - ram end address (4 bytes) ffh, 2fh, 00h, 00h (from 33rd byte) 37th byte to 40th byte - dummy data (4 bytes) 00h,00h,00h,00h (from 37th byte) 41th byte to 44th byte - dummy data (4 bytes) 00h, 00h, 00h, 00h (from 41st byte) 45th byte to 46th byte - fuse information (2 bytes from 45th byte) read protection/write protection 1) applied/applied : 00h, 00h 2) not applied/applied : 01h, 00h 3) applied/not applied : 02h, 00h 4) not applied/not applied : 03h, 00h 47th byte to 50th byte - flash memory start address (4 bytes) 00h, 00h, 01h, 00h (from 47th byte) 51th byte to 54th byte - flash memory end address (4 bytes) ffh, ffh, 02h, 00h (from 51st byte) 55th byte to 56th byte - number of sectors in flash memory (2 bytes) 10h, 00h (from 55th byte) 57th byte to 60th byte - start address of flash memory sectors of the same size (4 bytes) 00h, 00h, 01h, 00h (from 57th byte)
page 224 2007-10-15 tmp91fw60 61th byte to 64th byte - size (in half words) of flash memory sectors of the same size (4 bytes) 00h, 10h, 00h, 00h (from 61st byte) 65th byte - number of flash memory sectors of the same size (1 byte) 10h 66th byte - checksum value for 5th to 65th bytes 67th byte (wait for the next operation command data) - #1 for the desired baud rate setting, see table 14-6 . #2 after sending an error response, the device waits for operation command data (3rd byte). table 14-11 transfer format of single boot program [flash memory chip erase] transfer byte number transfer data from controller to device baud rate transfer data from device to controller boot rom 1st byte baud rate setting uart 86h desired baud rate #1 #1 for the desired baud rate setting, see table 14-6 . - 2nd byte - ack response to baud rate setting normal (baud rate ok) >uart 86h (if the desired baud rate cannot be set, operation is terminated.) 3rd byte operation command data (40h) - 4th byte - ack response to operation command #2 normal 40h error x1h communications x8h #2 after sending an error response, the device waits for operation command data (3rd byte). 5th byte erase enable command data (54h) - 6th byte - ack response to operation command #2 normal 54h error x1h communications x8h 7th byte - ack response to erase command normal 4fh error 4ch 8th byte - ack response normal 5dh error 60h 9th byte (wait for the next operation command data) - table 14-10 transfer format of single boot program [product information read](2/2) transfer byte number transfer data from controller to device baud rate transfer data from device to controller
page 225 2007-10-15 tmp91fw60 table 14-12 transfer format of single boot program [flash memory protect set] transfer byte number transfer data from controller to device baud rate transfer data from device to controller boot rom 1st byte baud rate setting uart 86h desired baud rate #1 #1 for the desired baud rate setting, see table 14-6 . - 2nd byte - ack response to baud rate setting normal (baud rate ok) >uart 86h (if the desired baud rate cannot be set, operation is terminated.) 3rd byte operation command data (60h) - 4th byte - ack response to operation command #2 normal 60h error x1h communications x8h #2 after sending an error response, the device waits for operation command data (3rd byte). 5th byte to 16th byte password data (12 bytes) (02fef4h to 02feffh) - 17th byte checksum value for 5th to 16th bytes - 18th byte - ack response to checksum value #2 normal 60h error 61h communications 68h 19th byte - ack response to protect set command normal 6fh error 6ch 20th byte - ack response normal 31h error 34h 21th byte (wait for the next operation command data) -
page 226 2007-10-15 tmp91fw60 14.4.7 boot program when the device starts up in single boot mode, the boot program is activated. the following explains the commands that are used in the boot program to communicate w ith the controller when the device starts up in single boot mode. use this information for creating a controller for using single boot mode or for building a user boot environment. 1. ram transfer command in ram transfer, data is transferred from the co ntroller and stored in the device's internal ram. when the transfer completes normally, the boot pr ogram will start running th e transferred user pro- gram. up to 7.5 kbytes of data can be transferre d as a user program. (this limit is implemented in the boot program to protect the st ack pointer area.) the user progra m starts executing from the ram storage start address. this ram transfer function enables a user-created program/erase routine to be executed, allowing the user to implement their ow n on-board programming method. to perform on-board programming with a user program, the flash memory command sequences (see section 14.6) must be used. after the ram transfer command has been completed, the entire internal ram area can be used. if read protection or write protection is applied on the device or a password error occurs, this com- mand will not be executed. 2. flash memory sum command this command calculates the sum of 128 kbytes of data in the flash memory and returns the result. there is no operation command available to the boot program for reading data from the entire area of the flash memory. instead, this flash me mory sum command can be used. reading the sum value enables revision management of the application program. 3. product information read command this command returns the information about the device including its part number and memory details stored in the flash memory at addresse s 02fef0h to 02fef3h. th is command can also be used for revision management of the application program. 4. flash memory chip erase command this command erases all the sector s in the flash memory. if read protection or write protection is applied on the device, all the sectors in the flash me mory are erased and the read protection or write protection is cleared. since this command is also used to restore the operation of the boot program when the password is forgotten, it does not include password verification. 5. flash memory protect set command this command sets both read pr otection and write protection on the device. however, if a pass- word error occurs, this comm and will not be executed. when read protection is set, the flash memory cannot be read in programmer mode. when write protection is set, the flash memory cannot be written in programmer mode.
page 227 2007-10-15 tmp91fw60 14.4.8 ram transfer command see table 14-8. 1. from the controller to the device the data in the 1st byte is used to determine the baud rate. the 1st byte is transferred with receive operation disabled (sc1mod0 = 0). (the baud rate is determined using an internal timer.) to communicate in uart mode send the value 86h from the controller to the target board using uart settings at the desired baud rate. if the serial operation mode is de termined as uart, the device checks to see whether or not the desired baud rate can be set. if the device determines that the desired baud rate cannot be set, operation is terminated and no communications can be established. 2. from the device to the controller the data in the 2nd byte is the ack response returned by the device for the serial operation mode setting data sent in the 1st byte. if the data in the 1st byte is found to signify uart and the desired baud rate can be set, the device returns 86h. baud rate determination the device determines whether or not the desired baud rate can be set. if it is found that the baud rate can be set, the boot program rewrites the br1cr and br1add values and returns 86h. if it is found that the desired baud rate cannot be set, operation is terminated and no data is returned. the controller sets a time-out time (5 seconds) after it has finished sending the 1st byte. if the contro ller does not receive the response (86h) normally w ithin the time-out time, it should be considered that the device is unable to communicate. receive operation is enabled (sc1mod0 = 1) before 86h is written to the transmission buffer. 3. from the controller to the device the data in the 3rd byte is op eration command data. in this cas e, the ram transfer command data (10h) is sent from the controller to the device. 4. from the device to the controller the data in the 4th byte is the ack response to the operation command data in the 3rd byte. first, the device checks to see if the received data in the 3rd byte contains any error. if a receive error is found, the device returns the ack response data fo r communications error (bit 3) x8h and waits for the next operation command data (3rd byte). the uppe r four bits of the ack response data are unde- fined (they are the upper four bits of the immediately preceding operation command data). next, if the data received in th e 3rd byte correspond s to one of the oper ation commands given in table 14-7, the device echoes back the received data (ack response for normal reception). in the case of the ram transfer command, if read or wr ite protection is not applied, 10h is echoed back and then execution branches to the ram transfer processing routine. if protection is applied, the device returns the corresponding ack response data (bit 2/1) x6h and waits for the next operation command data (3rd byte). the upper four bits of the ack response data are undefined. (they are the upper four bits of th e immediately preceding op eration command data.) after branching to the ram transf er processing routine, the device checks the data in the password area. for details, see " 14.4.15 password ". if the data in the 3rd byte does not correspond to any operation command, the device returns the ack response data for operation command error (b it0) x1h and waits for the next operation com- mand data (3rd byte). the upper four bits of the ack response data are undefined. (they are the upper four bits of th e immediately preceding op eration command data.)
page 228 2007-10-15 tmp91fw60 5. from the controller to the device the 5th to 16th bytes contain password data (12 bytes). the data in the 5th to 16th bytes is verified against the data at addresses 02fef4h to 02feffh in the flash memory, respectively. 6. from the controller to the device the 17th byte contains checksum data. the checksum data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in the 5th to 16th bytes by unsigned 8-bit addition (ignoring any overflow). for details on checksum, see " 14.4.17 how to calculate checksum ". 7. from the device to the controller the data in the 18th byte is the ack response data to the 5th to 17th bytes (ack response to the checksum value). the device first checks to see whet her the data received in the 5th to 17th bytes contains any error. if a receive error is found, the device return s the ack response data for commu- nications error (bit 3) 18h and waits for the next operation command data (3rd byte). the upper four bits of the ack response data are the upper four bits of the immediatel y preceding operation com- mand data, so the value of these bits is ?1?. next, the device checks the checksum data in the 17th byte. this check is made to see if the lower 8-bit value obtained by summing the data in the 5th to 17th bytes by unsigned 8-bit addition (ignoring any overflow) is 00h. if the value is not 00h, the device returns the ack response data for checksum error (bit 0) 11h and waits for the next operation command data (3rd byte). finally, the device examines the result of password verification. if all the data in the 5th to 16th bytes is not verified correctly, the device return s the ack response data for password error (bit 0) 11h and waits for the next operation command data (3rd byte). if no error is found in all the above checks, the device returns the ack response data for normal reception 10 h. 8. from the controller to the device the data in the 19th to 22nd bytes indicates the ra m start address for storing block transfer data. the 19th byte corresponds to address bits 31 to 24, the 20th byte to address bits 23 to 16, the 21st byte to address bits 15 to 8, and the 22nd byte to address bits 7 to 0. 9. from the controller to the device the data in the 23rd and 24th byt es indicates the number of bytes to be transferred. the 23rd byte corresponds to bits 15 to 8 of the transfer byte co unt and the 24th byte corresponds to bits 7 to 0. 10. from the controller to the device the data in the 25th byte is checksum data. th e checksum data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in the 19th to 24th bytes by unsigned 8-bit addition (ignoring any overflow). for details on checksum, see " 14.4.17 how to calculate checksum ". note: the data in the 19th to 25th bytes should be placed within addresses 001000h to 002dffh (7.5kbytes) in the internal ram.
page 229 2007-10-15 tmp91fw60 11. from the device to the controller the data in the 26th byte is the ack response data to the data in the 19th to 25th bytes (ack response to the checksum value). the device first checks to see whether the data r eceived in the 19th to 25 th bytes contains any error. if a receive error is found, the device retu rns the ack response data for communications error (bit 3) 18h and waits for the next operation command (3rd byte). the upper four bits of the ack response data are the upper four bits of the immediately preceding operation command data, so the value of these bits is ?1?. next, the device checks the checksum data in the 25th byte. this check is made to see if the lower 8-bit value obtained by summing the data in the 19th to 25th bytes by unsigned 8-bit addition (ignoring any overflow) is 00h. if the value is not 00h, the device returns the ack response data for checksum error (bit 0) 11h and waits for the next operation command data (3rd byte). 12. from the controller to the device the data in the 27th to m'th bytes is the data to be stored in the ram. this data is written to the ram starting at the address specified in the 19th to 22nd bytes. the number of bytes to be written is specified in the 23rd and 24th bytes. 13. from the controller to the device the data in the (m+1)th byte is checksum data . the checksum data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in the 27th to m'th bytes by unsigned 8-bit addition (ignoring any overflow). for details on checksum, see " 14.4.17 how to calculate checksum ". 14. from the device to the controller the data in the (m+2)th byte is the ack response data to the 27th to (m+1)th bytes (ack response to the checksum value). the device first checks to see whether the data in th e 27th to (m+1)th byte contains any error. if a receive error is found, the device returns the ack response data for communications error (bit 3) 18h and waits for the next operat ion command (3rd byte). the upper four bits of the ack response are the upper four bits of the immediately preceding operation comma nd data, so the value of these bits is ?1?. next, the device checks the checksum data in the (m +1)th byte. this check is made to see if the lower 8-bit value obtained by summing the data in the 27th to (m+1)th bytes by unsigned 8-bit addi- tion (ignoring any overflow) is 00h. if the valu e is not 00h, the device returns the ack response data for checksum error (bit 0) 11h and waits for the next operation command data (3rd byte). if no error is found in all the above checks, the device returns the ack response data for normal reception 10h. 15. from the device to the controller if the ack response data in the (m+2)th byte is 10h (normal reception), the boot program then jumps to the ram start address sp ecified in the 19th to 22nd bytes.
page 230 2007-10-15 tmp91fw60 14.4.9 flash memory sum command see table 14-9. 1. the data in the 1st and 2nd bytes is the same as in the case of th e ram transfer command. 2. from the controller to the device the data in the 3rd byte is operation comm and data. the flash memory sum command data (20h) is sent here. 3. from the device to the controller the data in the 4th byte is the ack response data to the operation command data in the 3rd byte. the device first checks to see if the data in the 3rd byte contains any erro r. if a receive error is found, the device returns the ack response data fo r communications error (bit 3) x8h and waits for the next operation command data (3rd byte). the uppe r four bits of the ack response data are unde- fined. (they are the upper four bits of the immediately pr eceding operation command data.) then, if the data in the 3rd byte corresponds to one of the operation command values given in table 14-7, the device echoes back the received data (ack respons e for normal reception). in this case, 20h is echoed back and execu tion then branches to the flas h memory sum processing routine. if the data in the 3rd byte does not correspond to any operation command, the device returns the ack response data for operation command error (b it 0) x1h and waits for the next operation com- mand data (3rd byte). the upper four bits of the ack response data are undefined. (they are the upper four bits of th e immediately preceding op eration command data.) 4. from the device to the controller the data in the 5th and 6th bytes is the upper and lower data of the sum value, respectively. for details on sum, see " 14.4.16 how to calculate sum ". 5. from the device to the controller the data in the 7th byte is checksum data. this is the two's complement of the lower 8-bit value obtained by summing the data in the 5th and 6th bytes by unsigned 8-bit addition (ignoring any overflow). 6. from the controller to the device the data in the 8th byte is the next operation command data.
page 231 2007-10-15 tmp91fw60 14.4.10product information read command see table 14-10. 1. the data in the 1st and 2nd bytes is the same as in the case of th e ram transfer command. 2. from the controller to the device the data in the 3rd byte is operation command data. the product inform ation read command data (30h) is sent here. 3. from the device to the controller the data in the 4th byte is the ack response data to the operation command data in the 3rd byte. the device first checks to see if the data in the 3rd byte contains any erro r. if a receive error is found, the device returns the ack response data fo r communications error (bit 3) x8h and waits for the next operation command data (3rd byte). the uppe r four bits of the ack response data are unde- fined. (they are the upper four bits of the immediately pr eceding operation command data.) then, if the data in the 3rd byte corresponds to one of the operation command values given in table 14-7, the device echoes back the received data (ack respons e for normal reception). in this case, 30h is returned and executi on then branches to the product information read processing rou- tine. if the data in the 3rd byte does not correspond to any operation command, the device returns the ack response data for operation command error (b it 0) x1h and waits for the next operation com- mand data (3rd byte). the upper four bits of the ack response data are undefined. (they are the upper four bits of th e immediately preceding op eration command data.) 4. from the device to the controller the data in the 5th to 8th bytes is the data stor ed at addresses 02fef0h to 02fef3h in the flash memory. by writing the id information of software at these addresses, the version of the software can be managed. (for example, 0002h can indi cate that the software is now in version 2.) 5. from the device to the controller the data in the 9th to 20th bytes denotes the part number of the device. 'tmp91fw60 _ _ _ ' is sent in ascii code starting from the 9th byte. note: an underscore ('_') indicates a space. 6. from the device to the controller the data in the 21st to 24th bytes is the passwor d comparison start addre ss. f4h, feh, 02h and 00h are sent starting from the 21st byte. 7. from the device to the controller the data in the 25th to 28th bytes is the ram star t address. 00h, 10h, 00h and 00h are sent start- ing from the 25th byte. 8. from the device to the controller the data in the 29th to 32nd bytes is the ram (user area) end address. ffh, 2dh, 00h and 00h are sent starting from the 29th byte. 9. from the device to the controller the data in the 33rd to 36th bytes is the ram en d address. ffh, 2fh, 00 h and 00h are sent start- ing from the 33rd byte. 10. from the device to the controller the data in the 37th to 44th bytes is dummy data. 11. from the device to the controller the data in the 45th and 46th bytes contains the protection status and sector division information of the flash memory. >bit 0 indicates the read protection status. 0: read protection is applied.
page 232 2007-10-15 tmp91fw60 1: read protection is not applied. >bit 1 indicates the write protection status. 0: write protection is applied. 1: write protection is not applied. >bit 2 indicates whether or not the flash memory is divided into sectors. 0: the flash memory is divided into sectors. 1: the flash memory is not divided into sectors. >bits 3 to 15 are sent as ?0?. 12. from the device to the controller the data in the 47th to 50th bytes is the flash memory start address. 00h, 00h, 01h and 00h are sent starting from the 47th byte. 13. from the device to the controller the data in the 51st to 54th bytes is the flash memory end address. ffh, ffh, 02h and 00h are sent starting from the 51st byte. 14. from the device to the controller the data in the 55th and 56th bytes indicates the number of sect ors in the flash memory. 10h and 00h are sent starting from the 55th byte. 15. from the device to the controller the data in the 57th to 65th bytes contains sect or information of the flas h memory. sector informa- tion is comprised of the start address (starting from the flash memory start address), sector size and number of consecutive sectors of the same size. note that the sector size is represented in word units. the data in the 57th to 65th bytes indicates 8 kbytes of sectors (sector 0 to sector 15). for the data to be transferred, see table 14-10. 16. from the device to the controller the data in the 66th byte is checksum data. this is the two's complement of the lower 8-bit value obtained by summing the data in the 5th to 65th bytes by unsigned 8-bit addition (ignoring any overflow). 17. from the controller to the device the data in the 67th byte is the next operation command data.
page 233 2007-10-15 tmp91fw60 14.4.11flash memory chip erase command see table 14-11. 1. the data in the 1st and 2nd bytes is the same as in the case of th e ram transfer command. 2. from the controller to the device the data in the 3rd byte is operation command da ta. the flash memory chip erase command data (40h) is sent here. 3. from the device to the controller the data in the 4th byte is the ack response data to the operation command data in the 3rd byte. the device first checks to see if the data in the 3rd byte contains any erro r. if a receive error is found, the device returns the ack response data fo r communications error (bit 3) x8h and waits for the next operation command data (3rd byte). the uppe r four bits of the ack response data are unde- fined. (they are the upper four bits of the immediately preced ing operation command data.) then, if the data in the 3rd byte corresponds to one of the operation command values given in table 14-7, the device echoes back the received data (ack respons e for normal reception). in this case, 40h is echoed back. if the data in the 3rd byte does not correspond to any operation command, the device returns the ack response data for operation command error (bit 0) x1h and waits for the next operation command data (3rd byte). the uppe r four bits of the ack response data are unde- fined. (they are the upper four bits of the immediately pr eceding operation command data.) 4. from the controller to the device the data in the 5th byte is erase enable command data (54h). 5. from the device to the controller the data in the 6th byte is the ack response data to the erase enable command data in the 5th byte. the device first checks to see if the data in the 5t h byte contains any error. if a receive error is found, the device returns the ack response data fo r communications error (bit 3) x8h and waits for the next operation command data (3rd byte). the uppe r four bits of the ack response data are unde- fined (they are the upper four bits of th e immediately preceding operation command data.) then, if the data in the 5th byte corresponds to the erase enable command data, the device echoes back the received data (ack response for normal reception). in this case, 54h is echoed back and execution jumps to the flash memory chip erase processing routine. if the data in the 5th byte does not correspond to the erase enable command data , the device returns the ack response data for operation command error (bit 0) x1h and waits for the next operation command (3rd byte). the upper four bits of the ack respons e data are undefined. (they are the upper four bits of the immedi- ately preceding operat ion command data.) 6. from the device to the controller the data in the 7th byte indicates whether or not the erase operation has completed successfully. if the erase operation has completed successfully, the de vice returns the end code (4fh). if an erase error has occurred, the device re turns the error code (4ch). 7. from the device to the controller the data in the 8th byte is ack response data. if the erase operation ha s completed successfully, the device returns the ack response for erase comple tion (5dh). if an erase error has occurred, the device returns the ack response for erase error (60h). 8. from the controller to the device the data in the 9th byte is the next operation command data.
page 234 2007-10-15 tmp91fw60 14.4.12flash memory protect set command see table 14-12. 1. the data in the 1st and 2nd bytes is the same as in the case of th e ram transfer command. 2. from the controller to the device the data in the 3rd byte is operation command data. the flash memory protect set command data (60h) is sent here. 3. from the device to the controller the data in the 4th byte is the ack response data to the operation command data in the 3rd byte. the device first checks to see if the data in the 3rd byte contains any erro r. if a receive error is found, the device returns the ack response data fo r communications error (bit 3) x8h and waits for the next operation command data. the upper four bits of the ack response data are undefined. (they are the upper four bits of the im mediately preceding operation command data.) then, if the data in the 3rd byte corresponds to one of the operation command data values given in table 14-7, the device echoes back the received data (ack respons e for normal reception). in this case, 60h is echoed back and execu tion branches to the fl ash memory protect set processing routine. after branching to this routine, the data in the password area is checked. for details, see " 14.4.15 password ". if the data in the 3rd byte does not correspond to any operation command, the device returns the ack response data for operation command error (bit 0) x1h and waits for the next oper- ation command data (3rd byte). the upper four bits of the ack response data are undefined. (they are the upper four bits of the immediately precedin g operation command data.) 4. from the controller to the device the data in the 5th to 16th bytes is password data (12 bytes). the data in the 5th byte is verified against the data at address 02fef4h in the flash me mory and the data in the 6th byte against the data at address 02fef5h. in this manner , the received data is verified cons ecutively against the data at the specified address in the flash memory. the data in th e 16th byte is verified ag ainst the data at address 02feffh in the flash memory. 5. from the controller to the device the data in the 17th byte is checksum data. th e checksum data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in 5th to 16th bytes by unsigned 8-bit addition (ignoring any overflow). for details on checksum, see " 14.4.17 how to calculate checksum ". 6. from the device to the controller the data in the 18th byte is the ack response data to the data in the 5th to 17th bytes (ack response to the checksum value). the device first checks to see whether the data in the 5th to 17th bytes contains any error. if a receive error is found, the device returns the ack response data for communications error (bit 3) 68h and waits for the next operation command data (3rd byte). the upper four bits of the ack response data are the upper four bits of the immediately preceding operation command data, so the value of these bits is ?6?. then, the device checks the checksum data in the 17th byte. this check is made to see if the lower 8 bits of the value obtained by summing the data in the 5th to 17th bytes by unsigned 8-bit addition (ignoring any overflow) is 00h. if the value is not 00h, the device returns the ack response data for checksum error (bit 0) 61h and waits for the next operation command data (3rd byte). finally, the device examines the result of password verification. if all the data in the 5th to 16th bytes is not verified correctly, the device return s the ack response data for password error (bit 0) 61h and waits for the next operation command data (3rd byte). if no error is found in the ab ove checks, the device returns the ack response data for normal reception 60h.
page 235 2007-10-15 tmp91fw60 7. from the device to the controller the data in the 19th byte indicates whether or not the protect set opera tion has completed success- fully. if the operation has completed successfully, th e device returns the end code (6fh). if an error has occurred, the device retu rns the error code (6ch). 8. from the device to the controller the data in the 20th byte is ack response data. if the protect set operat ion has completed success- fully, the device returns the ack response data for normal completion (31h). if an error has occurred, the device returns the ack response data for error (34h). 9. from the device to the controller the data in the 21st byte is the next operation command data. 14.4.13ack response data the boot program notifies the controller of its processing status by sending various response data. table 14- 13 to table 14-18 show the ack respons e data returned for each type of r eceived data. the upper four bits of ack response data are a direct refl ection of the upper four bits of th e immediately preceding operation com- mand data. bit 3 indicates a receive error and bit 0 indicates an operat ion command error, checksum error or password error. note: if the desired baud rate cannot be set, the dev ice returns no data and terminates operation. note:the upper four bits are a direct reflection of the upper four bits of the immediately preceding operation com- mand data. table 14-13 ack response data to serial operation mode setting data transfer data meaning 86h the device can communicate in uart mode. (note) table 14-14 ack response data to operation command data transfer data meaning x8h (note) a receive error occurred in the operation command data. x6h (note) terminated receive operation due to protection setting. x1h (note) undefined operation command data was received normally. 10h received the ram transfer command. 20h received the flash memory sum command. 30h received the product information read command. 40h received the flash memory chip erase command. 60h received the flash memory protect set command. table 14-15 ack response data to checksum data for ram transfer command transfer data meaning 18h a receive error occurred. 11h a checksum error or password error occurred. 10h received the correct checksum value.
page 236 2007-10-15 tmp91fw60 note:these codes are returned for reconfirmation of communications. note:these codes are returned for reconfirmation of communications. 14.4.14determining se rial operation mode to communicate in uart mode, the cont roller should transmit the data va lue 86h as the first byte at the desired baud rate. figure 14-7 shows the waveform of this operation. figure 14-7 data for determ ining serial operation mode the boot program receives the first byte (86h) after re set release not as serial communications data. instead, the boot program uses the first byte to determine the ba ud rate. the baud rate is determined by the output peri- ods of tab, tac and tad as shown in figure 14-7 using the procedure shown in figure 14-8. the cpu monitors the level of the receive pin. upon detecting a level change, the cpu captures the timer value to determine the baud rate. table 14-16 ack response data to flash memory chip erase operation transfer data meaning 54h received the erase enable command. 4fh completed erase operation. 4ch an erase error occurred. 5dh (note) reconfirmation of erase operation 60h (note) reconfirmation of erase error table 14-17 ack response data to checksum data for flash memory protect set command transfer data meaning 68h a receive error occurred. 61h a checksum or password error occurred. 60h received the correct checksum value. table 14-18 ack response data to flash memory protect set operation transfer data meaning 6fh completed the protect (read/write) set operation. 6ch a protect (read/write) set error occurred. 31h (note) reconfirmation of protect (read/write) set operation 34h (note) reconfirmation of protect (read/write) set error 7#46
 *  v#$  2qkpv#  2qkpv$ 2qkpv% 2qkpv& dkv dkv dkv  dkv dkv dkv dkv dkv 5vctv 5vqr  v# &  v# % 
page 237 2007-10-15 tmp91fw60 figure 14-8 flowchart for serial operation mode receive operation initialize 16-bit timer b0 ( t1 = 8/fc, clear counter) start the prescaler start counting up of 16-bit timer b0 point a stop operation (endless loop) receive pin changed from high to low? yes yes yes start receive pin changed from low to high? capture timer value (tab) by software receive pin changed from high to low? capture timer value (tac) by software yes receive pin changed from low to high? capture timer value (tad) by software stop 16-bit timer b0 tac tad? back up tad value end yes point b point c point d
page 238 2007-10-15 tmp91fw60 14.4.15password when the ram transfer command (1 0h) or the flash memory protect set command (60h) is received as operation command data, password verification is performe d. first, the device echoes back the operation com- mand data (10h to 60h) and checks the data ( 12 bytes) in the password area (addresses 02fef4h to 02feffh). then, the device verifies the password data received in the 5th to 16th bytes against the data in the password area as shown in table 14-19. unless all the 12 bytes are verified co rrectly, a password error will occur. a password error will also occur if all the 12 bytes of password data contain the same value. only exception is when all the 12 bytes are ?ffh? and verified corr ectly and the reset vector area (addresses 02ff00h to 02ff02h) is all ?ffh?. in this cas e, a blank device will be assumed and no password error will occur. if a password error has occurred, the device returns th e ack response data for password error in the 18th byte. table 14-19 password verification table receive data data to be verified against 5th byte data at address 02fef4h 6th byte data at address 02fef5h 7th byte data at address 02fef6h 8th byte data at address 02fef7h 9th byte data at address 02fef8h 10th byte data at address 02fef9h 11th byte data at address 02fefah 12th byte data at address 02fefbh 13th byte data at address 02fefch 14th byte data at address 02fefdh 15th byte data at address 02fefeh 16th byte data at address 02feffh example of data that cannot be specified as a password for blank products (note) the password of a blank product must be all ?ffh? (ffh, ffh, ffh, ffh, ffh, ffh, ffh, ffh, ffh, ffh, ffh, ffh). note:a blank product is a product in which all the bytes in the password area (addresses 02fef4h to 02feffh) and the reset vector area (addresses 02ff00h to 02ff02h) are ?ffh?. for programmed products the same 12 consecutive bytes cannot be specified as a password. the table below shows password error examples. programmed product 1 2 3 4 5 6 7 8 9 10 11 12 note error example 1 ffh ffh ffh ffh ffh ffh ffh ffh ffh ffh ffh ffh all"ff" error example 2 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h 00h all"00" error example 3 5ah 5ah 5ah 5ah 5ah 5ah 5ah 5ah 5ah 5ah 5ah 5ah all"5a"
page 239 2007-10-15 tmp91fw60 14.4.16how to calculate sum sum is calculated by summing the values of all data read from the flash memory by unsigned 8-bit addition and is returned as a word (16-bit) value. the resulting sum value is sent to the controller in order of upper 8 bits and lower 8 bits. all the 128 kbytes of data in the flash memory are include d in the calculation of sum. when the flash memory sum command is ex ecuted, sum is calculated in this way. 14.4.17how to calculate checksum checksum is calculated by taking the two's complement of the lower 8-bit value obtained by summing the values of received data by unsign ed 8-bit addition (ignoring any over flow). when the flash memory sum command or the product info rmation read command is executed, checksum is calculated in this way. the controller should also use this checksum calculation method for sending checksum values. example: calculating checksum for the flash memory sum command when the upper 8-bit data of sum is e5h and the lower 8-bit data is f6h, checksum is calculated as shown below. first, the upper 8 bits and lower 8 bits of the sum value are added by unsigned operation. e5h+f6h = 1dbh then, the two's complement of the lower 8 bits of this result is obtained as shown below. the resulting checksum value (25h) is sent to the controller. 0-dbh = 25h 14.5 user boot mode (in single chip mode) user boot mode, which is a sub mode of single chip mode, enables a user-created flash memory program/erase routine to be used. to do so, the operation mode of single chip mode must be changed from normal mode for exe- cuting a user application program to user boot mode for programming/erasing the flash memory. for example, the reset processing rou tine of a user application program may include a routine fo r selecting normal mode or user boot mode upon entering single chip mo de. any mode-selecting condition may be set using the device's i/o to suit the user system. to program/erase the flash memory in user boot mode, a program/erase routine must be incorporated in the user application program in advance. since the processor cannot read data from th e internal flash memory while it is being programmed or erased, the program/erase routine mu st be executed from the outside of the flash memory. while the flash memory is being programmed/erased in user boot mode, interrupts must be disabled. the pages that follow explain the procedure for progra mming the flash memory usi ng two example cases. in one case the program/erase routine is stored in the internal flash memory (1-a); in the other the program/erase routine is transferred from an ex ternal source (1-b).  #*  $*  %*  &*  9jgp57/kuecnewncvgfhtqovjghqwtfcvcgpvtkgu ujqypvqvjgnghvvjgtguwnvkucuhqnnqyu  #* $* %* &*'#*      57/wrrgtdkvu*    57/nqygtdkvu'#*   6jwuvjg57/xcnwgkuugpvvqvjgeqpvtqnngtkp qtfgtqh*cpf'#*
page 240 2007-10-15 tmp91fw60 14.5.1 (1-a) program/era se procedure example 1 when the program/erase routine is stored in the internal flash memory (step-1)environment setup first, the condition (e.g. pin status) for entering user boot mode must be set and the i/o bus for trans- ferring data must be determined. then, the device's peripheral circuitry must be designed and a corre- sponding program must be written. before mounting the device on the board, it is necessary to write the following four routines into one of the sectors in the flash memory. (a)mode select routine: selects normal mode or user boot mode. (b)program/erase routine: loads program/erase data from an external source and programs/erases the flash memory. (c)copy routine 1: copies routines (a) to (d) into the internal ram or external memory. (d)copy routine 2: copies routines (a) to (d) from the internal ram or external memory into the flash memory. note:the above (d) is a routine for reconstructing the progr am/erase routine on the flash memory. if the entire flash memory is always programmed and the program/erase routine is included in the new user application pro- gram, this copy routine is not needed. 
6/2(9  4#/  =?    
   
+1     %qpvtqnngt 0gywugt crrnkecvkqp rtqitco (ncujogoqt[ 1nfwugtcrrnkecvkqp rtqitco  4gugvrtqeguukpitqwvkpg
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg 
page 241 2007-10-15 tmp91fw60 (step-2) entering user boot mode (using the reset processing) after reset release, the reset pro cessing program determines whether or not the device should enter user boot mode. if the condition for entering user boot mode is true, user boot mode is entered to program/ erase the flash memory. (step-3) copying the program/erase routine after the device has entered user boot mode, the copy routine 1 (c) copies the routines (a) to (d) into the internal ram or external memory (the rout ines are copied into the internal ram here.)   4#/  =?   
  
+1     4'5'6  %qpfkvkqphqt gpvgtkpi7ugt $qqvoqfg
wugturgekhkgf   
6/2(9 (ncujogoqt[ 1nfwugtcrrnkecvkqp rtqitco  4gugvrtqeguukpitqwvkpg
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg  %qpvtqnngt 0gywugt crrnkecvkqp rtqitco      4#/  =?    

+1        
6/2(9 (ncujogoqt[ 1nfwugtcrrnkecvkqp rtqitco  4gugvrtqeguukpitqwvkpg
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg 
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg  %qpvtqnngt 0gywugt crrnkecvkqp rtqitco
page 242 2007-10-15 tmp91fw60 (step-4) erasing the flash memory by the program/erase routine control jumps to the program/erase routine in the ram and the old user progr am area is erased (sector erase or chip erase). (in this case, the flash memory erase comm and is issued from the ram.) note: if data is erased on a sector basis and the routines (a) to (d) are left in the flash memory, only the program/ erase routine (b) need be copied into the ram. (step-5) restoring the user boot program in the flash memory the copy routine 2 (d) in the ram copies the routines (a) to (d) into the flash memory. note: if data is erased on a sector basis and the routines (a) to (d) are left in the flash memory, step 5 is not needed.   4#/ 
   
+1      'tcugf
6/2(9 %qpvtqnngt 0gywugt crrnkecvkqp rtqitco (ncujogoqt[
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg       4#/  =?  

+1       
6/2(9 (ncujogoqt[  4gugvrtqeguukpitqwvkpg
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg 
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg  %qpvtqnngt 0gywugt crrnkecvkqp rtqitco
page 243 2007-10-15 tmp91fw60 (step-6) writing the new user application program to the flash memory the program/erase routine in the ra m is executed to load the new us er application program from the controller into the erased area of the flash memory. (step-7) executing the new user application program the reset input pin is driven low (?0?) to reset the device. the mode setting condition is set for nor- mal mode. after reset release, the device will st art executing the new us er application program.   4#/  =?  
   
+1          
6/2(9 (ncujogoqt[ 1nfwugtcrrnkecvkqp rtqitco  4gugvrtqeguukpitqwvkpg
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg 
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg  %qpvtqnngt 0gywugt crrnkecvkqp rtqitco   4#/  =?    

+1     4'5'6 %qpfkvkqphqt gpvgtkpi0qtocn oqfg  
6/2(9 (ncujogoqt[ 1nfwugtcrrnkecvkqp rtqitco  4gugvrtqeguukpitqwvkpg
f %qr[tqwvkpg 
e %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 2tqitcogtcugtqwvkpg  %qpvtqnngt
page 244 2007-10-15 tmp91fw60 14.5.2 (1-b) program/era se procedure example 2 in this example, only the boot program (minimum requirement) is stored in the flash memory and other nec- essary routines are supp lied from the controller. (step-1)environment setup first, the condition (e.g. pin status) for entering user boot mode must be set and the i/o bus for trans- ferring data must be determined. then, the device's peripheral circuitry must be designed and a corre- sponding program must be written. before mounting the device on the board, it is necessary to write the following two routines into one on the sectors in the flash memory. (a)mode select routine: selects normal mode or user boot mode. (b)transfer routine: loads the program/erase routin e from an ex ternal source. the following routines are pr epared on the controller. (c)program/erase routine: programs/erases the flash memory. (d)copy routine 1: copies routines (a) and (b) into th e internal ram or external memory. (e)copy routine 2: copies routines (a) and (b) from the internal ram or external memory into the flash memory. 
%qpvtqnngt 
+1  (ncujogoqt[  4#/  =  4gugvrtqeguukpitqwvkpg ?
c  /qfgugngevtqwvkpg  1nfwugtcrrnkecvkqp  rtqitco  
d  6tcpuhgttqwvkpg    
e 2tqitcogtcugtqwvkpg
f %qr[tqwvkpg 
g %qr[tqwvkpg 
6/2(9 0gywugtcrrnkecvkqp rtqitco
page 245 2007-10-15 tmp91fw60 (step-2) entering user boot mode (using the reset processing) the following explanation assumes that these routines are incorporated in the reset processing program. after reset release, the reset pro cessing program first determines whether or not the device should enter user boot mode. if the condition for entering user boot mode is true, user boot mode is entered to pro- gram/erase the flash memory. (step-3) copying the program/eras e routine to the internal ram after the device has entered user boot mode, the tran sfer routine (b) transfers the routines (c) to (e) from the controller to the internal ram (or external memory). (the routines are copied into the internal ram here.) 

+1  4'5'6  %qpfkvkqphqt gpvgtkpi7ugt $qqvoqfg
wugturgekhkgf    4#/  =?
c    
d  6tcpuhgttqwvkpg      
6/2(9 (ncujogoqt[  4gugvrtqeguukpitqwvkpg /qfgugngevtqwvkpg 1nfwugtcrrnkecvkqp rtqitco %qpvtqnngt
e 2tqitcogtcugtqwvkpg
f %qr[tqwvkpg
g %qr[tqwvkpg  0gywugtcrrnkecvkqp rtqitco 

+1   4#/  =?
c  /qfgugngevtqwvkpg     
e 2tqitcogtcugtqwvkpg   
g %qr[tqwvkpg  
f %qr[tqwvkpg 
6/2(9 %qpvtqnngt
e 2tqitcogtcugtqwvkpg
f %qr[tqwvkpg
g %qr[tqwvkpg  0gywugtcrrnkecvkqp rtqitco (ncujogoqt[  4gugvrtqeguukpitqwvkpg 1nfwugtcrrnkecvkqp rtqitco
d  6tcpuhgttqwvkpg
page 246 2007-10-15 tmp91fw60 (step-4) executing the copy ro utine 1 in the internal ram control jumps to the internal ram and the copy rout ine 1 (d) copies the routin es (a) and (b) into the internal ram. (step-5) erasing the flash memory by the program/erase routine the program/erase routine (c) eras es the old user program area. 

+1   4#/  =?
c     
d       
g %qr[tqwvkpg 
f %qr[tqwvkpg
c /qfgugngevtqwvkpg 
d 6tcpuhgttqwvkpg 
e 2tqitcogtcugtqwvkpg 
6/2(9 (ncujogoqt[ /qfgugngevtqwvkpg 1nfwugtcrrnkecvkqp rtqitco 6tcpuhgttqwvkpg  4gugvrtqeguukpitqwvkpg %qpvtqnngt
e 2tqitcogtcugtqwvkpg
f %qr[tqwvkpg
g %qr[tqwvkpg  0gywugtcrrnkecvkqp rtqitco 

+1   4#/            'tcugf 
6/2(9
g %qr[tqwvkpg 
f %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 6tcpuhgttqwvkpg 
e 2tqitcogtcugtqwvkpg  (ncujogoqt[ %qpvtqnngt
e 2tqitcogtcugtqwvkpg
f %qr[tqwvkpg
g %qr[tqwvkpg  0gywugtcrrnkecvkqp rtqitco
page 247 2007-10-15 tmp91fw60 (step-6) restoring the user boot program in the flash memory the copy routine (e) copies the ro utines (a) and (b) from the internal ram into the flash memory. (step-7) writing the new user application program to the flash memory the program/erase routine (c) in the ram is execute d to load the new user application program from the controller into the eras ed area of the flash memory. 

+1   4#/  =?          
6/2(9
c 
d 
g %qr[tqwvkpg 
f %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 6tcpuhgttqwvkpg 
e 2tqitcogtcugtqwvkpg  (ncujogoqt[ /qfgugngevtqwvkpg 6tcpuhgttqwvkpg  4gugvrtqeguukpitqwvkpg %qpvtqnngt
e 2tqitcogtcugtqwvkpg
f %qr[tqwvkpg
g %qr[tqwvkpg  0gywugtcrrnkecvkqp rtqitco 

+1   4#/  =?          

6/2(9 %qpvtqnngt
e 2tqitcogtcugtqwvkpg
f %qr[tqwvkpg
g %qr[tqwvkpg  0gywugtcrrnkecvkqp rtqitco
c 
d 
g %qr[tqwvkpg 
f %qr[tqwvkpg
c /qfgugngevtqwvkpg
d 6tcpuhgttqwvkpg 
e 2tqitcogtcugtqwvkpg  (ncujogoqt[ /qfgugngevtqwvkpg 1nfwugtcrrnkecvkqp rtqitco 6tcpuhgttqwvkpg  4gugvrtqeguukpitqwvkpg
page 248 2007-10-15 tmp91fw60 (step-8) executing the new user application program the reset input pin is driven low (?0?) to reset the device. the mode setting condition is set for nor- mal mode. after reset release, the device will st art executing the new us er application program. 

+1  4'5'6  %qpfkvkqphqt gpvgtkpi0qtocn oqfg   4#/  =?     
6/2(9
c 
d  (ncujogoqt[ /qfgugngevtqwvkpg 1nfwugtcrrnkecvkqp rtqitco 6tcpuhgttqwvkpg  4gugvrtqeguukpitqwvkpg %qpvtqnngt
page 249 2007-10-15 tmp91fw60 14.6 flash memory command sequences the operation of the flash memory is comprised of six commands, as shown in table 14-20. addresses specified in each command sequence must be in an area where the flash memory is mapped. for details, see table 14-3. note 1: pa = program word address, pd = program word data set the address and data to be programmed. even-numbered addresses should be specified here. note 2: sa = sector erase address, each sector erase range is selected by address a23 to a13. note 3: when apply read protect and write protect, be sure to program the data of 00h. note: d15 to d8 and d5 to d0 are ?don't care?. table 14-20 command sequences command 1st bus write cycle 2nd bus write cycle 3rd bus write cycle 4th bus write cycle 5th bus write cycle 6th bus write cycle sequence addr. data addr. data addr. data addr. data addr. data addr. data 1 single word program aaah aah 554h 55h aaah a0h pa (note1) pd (note1) 2 sector erase (8kb erase) aaah aah 554h 55h aaah 80h aaah aah 554h 55h sa (note2) 30h 3 chip erase (all erase) aaah aah 554h 55h aaah 80h aaah aah 554h 55h aaah 10h 4 product id entry aaah aah 554h 55h aaah 90h 5 product id exit xxh f0h product id exit aaah aah 554h 55h aaah f0h 6 read protect set aaah aah 554h 55h aaah a5h 77eh f0h (note3) write protect set aaah aah 554h 55h aaah a5h 77eh 0fh (note3) table 14-21 hardware sequence flags status d7 d6 during auto opera- tion single word program d7 toggle sector erase/chip erase 0 toggle read protect set/write protect set cannot be used toggle
page 250 2007-10-15 tmp91fw60 14.6.1 single word program the single word program command sequence programs the flash memory on a word basis. the address and data to be programmed are specified in the 4th bus write cycle. it takes a maximum of 60 us to program a sin- gle word. another command sequence cannot be executed until the write operation has completed. this can be checked by reading the same address in the flash memory repeatedly until the same data is read consecutively. while a write operation is in progress, bit 6 of data is t oggled each time it is read. note:to rewrite data to flash memory addresses at which dat a (including ffffh) is already written, make sure to erase the existing data by ?sector erase? or ?chip erase? before rewriting data. 14.6.2 sector erase (8-kbyte erase) the sector erase command sequence erases 8 kbytes of data in the flash memory at a time. the flash mem- ory address range to be erased is specified in the 6th bus write cycle. for the addr ess range of each sector, see table 14-3. this command sequence cannot be used in programmer mode. it takes a maximum of 75 ms to erase 8 kbytes. another command sequence cannot be executed until the erase operation has completed. this can be checked by reading the same address in the flash memory repeat- edly until the same data is read consecutively. while a erase operation is in progress, bit 6 of data is toggled each time it is read. 14.6.3 chip erase (all erase) the chip erase command sequence erases the entire area of the flash memory. it takes a maximum of 300 ms to erase the entire flash memory. another command sequence cannot be exe- cuted until the erase operation has completed. this can be checked by reading the same address in the flash memory repeatedly until the same data is read consecu tively. while a erase operati on is in progress, bit 6 of data is toggled each time it is read. erase operations clear data to ffh. 14.6.4 product id entry when the product id entry command is executed, product id mode is entered. in this mode, the vendor id, flash macro id, flash size id, and read/write protect st atus can be read from the flash memory. in product id mode, the data in the flash memory cannot be read. 14.6.5 product id exit this command sequence is used to exit product id mode.
page 251 2007-10-15 tmp91fw60 14.6.6 read protect set the read protect set command sequence applies read protection on the flash memo ry. when read protection is applied, the flash memory cannot be read in pr ogrammer mode and the ram transfer command cannot be executed in single boot mode. to cancel read protection, it is n ecessary to execute the chip erase co mmand sequence. to check whether or not read protection is applied, read xxx77eh in product id mode. it takes a maximum of 60 us to set read pro- tection on the flash memory. another command sequence cannot be executed until th e read protection setting has completed. this can be checked by reading the same address in the fl ash memory repeatedly until the same data can be read consecutively. while a read protect oper ation is in progress, bit 6 of data is toggled each time it is read. 14.6.7 write protect set the write protect set command sequence applies write protection on the flash memory. when write protec- tion is applied, the flash memory cannot be written to in programmer mode and the ram transfer command cannot be executed in single boot mode. to cancel write protection, it is ne cessary to execute the chip erase command sequence. to check whether or not write protection is applied, read xxx77eh in product id mode. it takes a maximum of 60 us to set write protection. another command sequence cannot be executed until the write protection setting has completed. this can be checked by reading the same address in th e flash memory repeatedly until the same data can be read consecutively. while a write protect operation is in progress, bit 6 of data is togg led each time it is read. 14.6.8 hardware sequence flags the following hardware sequence flags are available to check the auto oper ation execution status of the flash memory. 1. data polling (d7) when data is written to the flash memory, d7 ou tputs the complement of its programmed data until the write operation has completed. after the writ e operation has completed, d7 outputs the proper cell data. by reading d7, therefor e, the operation status can be checked. while the sector erase or chip erase command sequence is being executed, d7 outputs ?0?. after the command sequence is completed, d7 outputs ?1? (cell data). then, the data written to all the bits can be read after waiting for 1 us. when read/write protection is applied, the data polling function cannot be used. instead, use the toggle bit (d6) to check the operation status. 2. toggle bit (d6) when the flash memory program, s ector erase, chip erase, write pr otect set, or read protect set command sequence is executed, bit 6 (d6) of the da ta read by read operat ions outputs ?0? and ?1? alternately each time it is read until the processing of the executed command sequence has com- pleted. the toggle bit (d6) thus provides a software means of checking whether or not the processing of each command sequence has comple ted. normally, the same addre ss in the flash memory is read repeatedly until the same data is read successively. the initial read of the to ggle bit always returns ?1?. note:the flash memory incorporated in the tmp91fw60 does not have an exceed-time-limit bit (d5). it is therefore necessary to set the data polling time limit and toggle bi t polling time limit so that polling can be stopped if the time limit is exceeded.
page 252 2007-10-15 tmp91fw60 14.6.9 data read data is read from the flash memory in byte units or word units. it is not nece ssary to execute a command sequence to read data from the flash memory. 14.6.10programming the flash me mory by the internal cpu the internal cpu programs the flash memory by using the command sequences and hardware sequence flags described above. however, since the flash memory canno t be read during auto op eration mode, the program/ erase routine must be executed outside of the flash memory. the cpu can program the flash memory either by using single boot mode or by using a user-created proto- col in single chip mode (user boot). 1. single boot: the microcontroller is started up in single boot mode to program the flash memory by the internal boot rom program. in this mode, the internal boot rom is mapped to an area including the interrupt vector table, in which the boot rom program is ex ecuted. the flash memory is mapped to an address area different from the boot rom area. the boot ro m program loads data into the flash memory by serial transfer. in single boot mode, interrupts must be disabled including non-maskable interrupts (nmi , etc.). for details, see " 14.4 single boot mode " 2. user boot: in this method, the flash memory is programme d by executing a user-cr eated routine in single chip mode (normal operation mode). in this mode, the user-created program/ erase routine must also be executed outside of the flash memory. it is also necessary to disable interrupts including non- maskable interrupts. the user should prepare a flash memory program/e rase routine (including routines for loading write data and writing the loaded data into the flas h memory). in the main program, normal operation is switched to flash memory pr ogramming operation to execute th e flash memory program/erase rou- tine outside of the flash memory area. for example, the flash me mory program/erase routine may be transferred from the flash memory to the internal ram and executed there or it may be prepared and executed in external memory. for details, see " 14.5 user boot mode (in single chip mode) ".
page 253 2007-10-15 tmp91fw60 flowcharts: flash memory access by the internal cpu single word program 2tqitcoeqoocpfugswgpeg (see the flowchart below) 5vctv 6qiingdkv
& .cuvcfftguu! no yes 2tqitcogpf address = address + 2 (even-numbered address/ word units) 2tqitco%qoocpf5gswgpeg
#fftguu&cvc xxxaaah/aah xxx554h/55h xxxaaah/a0h 'xgppwodgtgfrtqitcocfftguu
# rtqitcofcvc
yqtfwpkvu 4gcffcvcocvejgf rtqitcofcvc! #dpqtocngpf yes yes no no timeout(60 ? s) 9qtftgcf addr. = 2tqitcocfftguu 9qtftgcf addr. = 2tqitcocfftguu 4gcffcvcocvejgf rtqitcofcvc!
page 254 2007-10-15 tmp91fw60 chip erase/sector erase  %jkr'tcug%qoocpf5gswgpeg
#fftguu&cvc  zzz###*##*  zzz ** zzz###**  zzz###*##*  zzz** zzz###**  5gevqt'tcug%qoocpf5gswgpeg
#fftguu&cvc  zzz###*##*  zzz* *  zzz###**  zzz###*##*  zzz ** 5gevqtcfftguu*  'tcugeqoocpfugswgpeg
5ggvjghnqyejctvdgnqy   5vctv  6iingdkv
&  'tcuggpf   4gcffcvcdncpm! 
0qvg  #dpqtocngpf  ;gu  0q  6kogqwv 
%jkrou5gevqtou  0qvg+p%jkr'tcugyjgvjgtqtpqvvjggpvktghncujogoqt[ku dncpmkuejgemgf +p5gevqt'tcugyjgvjgtqtpqvvjgugngevgfugevqtkudn cpmkuejgemgf
page 255 2007-10-15 tmp91fw60 read/write protect set protect set command sequence (address/data) xxxaaah/aah xxx554h/55h xxxaaah/a5h set read protect xxx77eh/f0h set write protect xxx77eh/0fh set both read protect and write protect xxx77eh/00h protect set command sequence (see the flowchart below) start toggle bit (d6) protect set end abnormal end yes timeout (60 s) product id entry read data matched p ro g ram data? product id exit byte read (d7 to d0) addr. = xxx77eh no toggle bit (d6) protect set command sequence (see the flowchart below) product id entry product id exit
page 256 2007-10-15 tmp91fw60 data polling (d7) toggle bit (d6) note:hardware sequence flags are read from the flash memory in byte units or word units. va:in single word program, va denotes the address to be programmed. in sector erase, va denotes any address in the selected sector. in chip erase, va denotes an y address in the flash memory. in read protect set, va denotes the protect set address (xx77eh). in write protect set, va denotes the protect set address (xx77eh).  $[vgtgcf
&:*&  #fft8# 5vctv  &&cvc! ;gu 0q 
8#8cnkf#fftguu  1rgtcvkqpgpf 
0qvg $[vgtgcf
&vq& 0qvg  #fft8# & 6qiing ! 5vctv  0q  1rgtcvkqpgpf  ;gu  #fft8# $[vgtgcf
&vq& 0qvg
page 257 2007-10-15 tmp91fw60 product id entry product id exit  zzz** 5vctv  zzz###*##*  zzz###**  9ckvhqtpugeqtnqpigt
+&#eeguucpf'zkv6kog/czpuge ???:2tqfwev+&oqfguvctv:    2tqfwev+&tgcf 
5ggvjgvcdngdgnqy  4gcf8cnwgukp2tqfwev+&/qfg   #fftguu  4gcf8cnwg 8gpfqt+&  zzzz* * (ncujocetq+&  zzzz* * (ncujuk\g+&  zzzz* (* 4gcf9tkvg  2tqvgevuvcvwu  zzz'*  &cvcrtqitcoogfyjgprtqvgevkqpkuugv 9jgprtqvgevkqpkupqvugv((*   5vctv  zzz###* ##*  zzz* *  zzz###*(*    zzzzzz*(*     2tqfwev+&oqfggpf   5vctv 9ckvhqtpugeqtnqpigt
+&#eeguucpf'zkv6kog/czpuge 9ckvhqtpugeqtnqpigt
+&#eeguucpf'zkv6kog/czpuge 2tqfwev+&oqfggpf
page 258 2007-10-15 tmp91fw60 (example: program to be lo aded and executed in ram) erase the flash memory (chip erase) a nd then write 0706h to address fe0000h. ;#### flash memory ch ip erase processing #### ld xix, 0xfe0000 ; set start address chiperase: ld (0xfe0aaa), 0xaa ;1st bus write cycle ld (0xfe0554), 0x55 ;2nd bus write cycle ld (0xfe0aaa), 0x80 ;3rd bus write cycle ld (0xfe0aaa), 0xaa ;4th bus write cycle ld (0xfe0554), 0x55 ;5th bus write cycle ld (0xfe0aaa), 0x10 ;6th bus write cycle cal togglechk ; check toggle bit chiperase _ loop: ld wa, (xix+) ; read data from flash memory cp wa, 0xffff ; blank data? j ne,chiperase _ err ; if not blank data, jump to error processing cp xix, 0xffffff ; end address (0xffffff)? j ult,chiperase _ loop ; check entire memory area and then end loop processing ;#### flash memory program processing #### ld xix, 0xfe0000 ; set program address ld wa, 0x0706 ; set program data program: ld (0xfe0aaa), 0xaa ;1st bus write cycle ld (0xfe0554), 0x55 ;2nd bus write cycle ld (0xfe0aaa), 0xa0 ;3rd bus write cycle ld (xix), wa ;4th bus write cycle cal togglechk ; check toggle bit ld bc, (xix) ; read data from flash memory cp wa, bc j ne, program _ err ; if programmed data cannot be read, error is determined ld bc, (xix) ; read data from flash memory cp wa, bc j ne, program _ err ; if programmed data cannot be read, error is determined program _ end: j program _ end ; program operation end
page 259 2007-10-15 tmp91fw60 ;#### toggle bit (d6) check processing #### togglechk: ld l, (xix) and l, 0y01000000 ; check toggle bit (d6) ld h, l ; save first toggle bit data togglechk1: ld l, (xix) and l, 0y01000000 ; check toggle bit (d6) cp l, h ; toggle bit = toggled? j z, togglechk2 ; if not toggled, end processing ld h, l ; save current toggle bit state j togglechk1 ; recheck toggle bit togglechk2: ret ;#### error processing #### chiperase _ err: j chiperase _ err ; chip erase error program _ err: j program _ err ; program error
page 260 2007-10-15 tmp91fw60 (example: program to be lo aded and executed in ram) erase data at addresses ff0000h to ff1fffh (sector erase) and then write 0706h to address ff0000h. ;#### flash memory sector erase processing #### ld xix, 0xff0000 ; set start address sectorerase: ld (0xfe0aaa), 0xaa ;1st bus write cycle ld (0xfe0554), 0x55 ;2nd bus write cycle ld (0xfe0aaa), 0x80 ;3rd bus write cycle ld (0xfe0aaa), 0xaa ;4th bus write cycle ld (0xfe0554), 0x55 ;5th bus write cycle ld (xix), 0x30 ;6th bus write cycle cal togglechk ; check toggle bit sectorerase _ loop: ld wa, (xix+) ; read data from flash memory cp wa, 0xffff ; blank data? j ne,sectorerase _ err ; if not blank data, jump to error processing cp xix, 0xff1fff ; end address (0xff1fff)? j ult,sectorerase _ loop ; check erased sector area and then end loop processing ;#### flash memory program processing #### ld xix, 0xff0000 ; set program address ld wa, 0x0706 ; set program data program: ld (0xfe0aaa), 0xaa ;1st bus write cycle ld (0xfe0554), 0x55 ;2nd bus write cycle ld (0xfe0aaa), 0xa0 ;3rd bus write cycle ld (xix), wa ;4th bus write cycle cal togglechk ; check toggle bit ld bc, (xix) ; read data from flash memory cp wa, bc j ne, program _ err ; if programmed data cannot be read, error is determined ld bc, (xix) ; read data from flash memory cp wa, bc j ne, program _ err ; if programmed data cannot be read, error is determined program _ end: j program _ end ; program operation end
page 261 2007-10-15 tmp91fw60 ;#### toggle bit (d6) check processing #### togglechk: ld l, (xix) and l, 0y01000000 ; check toggle bit (d6) ld h, l ; save first toggle bit data togglechk1: ld l, (xix) and l, 0y01000000 ; check toggle bit (d6) cp l, h ; toggle bit = toggled? j z, togglechk2 ; if not toggled, end processing ld h, l ; save current toggle bit state j togglechk1 ; recheck toggle bit togglechk2: ret ;#### error processing #### sectorerase _ err: j sectorerase _ err ; sector erase error program _ err: j program _ err ; program error
page 262 2007-10-15 tmp91fw60 (example: program to be lo aded and executed in ram) set read protection and write protection on the flash memory. ;#### flash memory protect set processing #### ld xix, 0xfe077e ; set protect address protect: ld (0xfe0aaa), 0xaa ;1st bus write cycle ld (0xfe0554), 0x55 ;2nd bus write cycle ld (0xfe0aaa), 0xa5 ;3rd bus write cycle ld (xix), 0x00 ;4th bus write cycle cal togglechk ; check toggle bit cal pid _ entry ; ld a, (xix) ; read protected address lcal pid _ exit ; cp a, 0x00 ;(0xfe077e)=0x00? j ne, protect _ err ; protected? protect _ end: j protect _ end ; protect set operation completed protect _ err: j protect _ err ; protect set error ;#### product id entry processing #### pid _ entry: ld (0xfe0aaa), 0xaa ;1st bus write cycle ld (0xfe0554), 0x55 ;2nd bus write cycle ld (0xfe0aaa), 0x90 ;3rd bus write cycle ; --- wait for 300 nsec or longer (execute nop instruction [200nsec/@f fph =20mhz] two times) --- nop nop ; wait for 400 nsec ret ;#### product id exit processing #### pid _ exit: ld (0xfe0000), 0xf0 ;1st bus write cycle ; --- wait for 300 nsec or longer (execute nop instruction [200nsec/@f fph =20mhz] two times) --- nop nop ; wait for 400 nsec ret
page 263 2007-10-15 tmp91fw60 (example: program to be lo aded and executed in ram) read data from address fe0000h. ;#### toggle bit (d6) check processing #### togglechk: ld l, (xix) and l, 0y01000000 ; check toggle bit (d6) ld h, l ; save first toggle bit data togglechk1: ld l, (xix) and l, 0y01000000 ; check toggle bit (d6) cp l, h ; toggle bit = toggled? j z, togglechk2 ; if not toggled, end processing ld h, l ; save current toggle bit state j togglechk1 ; recheck toggle bit togglechk2: ret ;#### flash memory read processing #### read: ld wa, (0xfe0000) ; read data from flash memory
page 264 2007-10-15 tmp91fw60 15. electrical characteristics 15.1 absolute maximum ratings note: absolute maximum ratings are limiti ng values of operating and environmental conditions which should not be exceeded under the worst possible conditions. the equipment manufacturer should design so that no absolute maximum rating value is exceeded. exposure to conditions beyond those listed above may cause per manent damage to the device or affect device reliability, which could increase potential risks of personal injury due to ic blowup and/or burning. parameter symbol pin name rating unit supply voltage v cc ? 0.5 to 6.0 v input voltage v in ? 0.5 to v cc + 0.5 v output current (per pin) i ol1 p5, p6, p96, p97 2 ma output current (per pin) i ol2 p0, p1, p2, p3, p4, p7, p8, p90-p95, pa, pb, pz 5ma output current (per pin) i oh1 p5, p6, p96, p97 ? 2ma output current (per pin) i oh2 p0, p1, p2, p3, p4, p7, p8, p90-p95, pa, pb, pz ? 5ma output current (total) i ol 80 ma output current (total) i oh ? 80 ma power dissipation (t opr = 85 c) pd 600 mw soldering temperature (10 s) t solder 260 c storage temperature t stg ? 65 to 150 c operating temperature t opr ? 40 to 85 c solderability of lead free products test parameter test condition note solderability use of sn-37pb solder bath solder bath temperature 230 c, dipping time 5 [s] the number of times one, use of r-type flux pass: solderability rate until forming 95% use of sn-3.0ag-0.5 cu solder bath solder bath temperature 245 c, dipping time 5 [s] the number of times one, use of r-type flux (use of lead free)
page 265 2007-10-15 tmp91fw60 15.2 dc electrical characteristics note 1: typical values show those at t opr = 25 c and vdd = 5 v. note 2: i cc measurement conditions (normal, sl ow): all functions are operational; ou tput pins are open and input pins are level fixed. data and address bus cl = 30 pf loaded. note 3: when a program is executing in the flash memory or w hen data is being read from the flash memory, the flash memory operates in an intermittent manner, causing peak curr ents in the operation current, as shown in figure 15-1. in this case, the supply current i cc (in normal and slow modes) is defined as the sum of the average peak current and mcu current. parameter symbol condition min typ. max unit power supply voltage (av cc = dv cc ) (av ss = dv ss = 0v) v cc fc = 4 to 20 mhz fs = 30 to 34 khz 4.5 5.5 v for erase/program operations of flash memory (av cc = dv cc ) (av ss = dv ss = 0v) fc = 4 to 20 mhz t opr = -10 to 4 0 c 4.75 5.25 low-level input volt- age p00 to p17(ad0 to ad15) v il v cc = 4.5 to 5.5 v ? 0.3 0.8 v p20 to p27, pz0 to pz3 v il1 0.3 v cc reset , nmi , p30 to pb3 v il2 0.25 v cc am0, am1 v il3 0.3 x1 v il4 0.2 v cc high-level input volt- age p00 to p17(ad0 to ad15) v ih v cc = 4.5 to 5.5 v 2.2 v cc + 0.3 v p20 to p27, pz0 to pz3 v ih1 0.7 v cc reset , nmi , p30 to pb3 v ih2 0.75 v cc am0, am1 v ih3 v cc ? 0.3 x1 v ih4 0.8 v cc low-level output voltage v ol i ol = 1.6 ma (v cc = 4.5 to 5.5 v) 0.45 v high-level output voltage v oh i oh = ? 400 a (v cc = 4.5 to 5.5 v) 4.2 v i oh = ? 1.6 ma (v cc = 4.5 to 5.5 v) 2.4 input leakage current i li 0.0 v in v cc 0.02 5 a output leakage current i lo 0.2 v in v cc ? 0.2 0.05 10 power down voltage (while ram is being backed up in stop mode) v stop v il2 = 0.2 v cc v ih2 = 0.8 v cc 2.0 5.5 v reset pull-up resistor r rst v cc = 4.5 to 5.5 v 50 230 k pin capacitance c io fc = 1 mhz 10 pf schmitt width reset , nmi , int0 v th v cc = 4.5 to 5.5 v 0.4 1.0 v programmable pull-up resistor rkh v cc = 4.5 to 5.5 v 50 230 k normal (note 2) i cc v cc = 4.5 to 5.5 v fc = 20 mhz 25 35 ma idle2 815 idle1 3.5 8 slow (note 2) v cc = 4.5 to 5.5 v fs = 32.768 khz 80 100 a stop t opr 50 c v cc = 4.5 to 5.5 v 0.5 10 a t opr 70 c 25 t opr 85 c 50 peak current for intermittent operation (note 3,4) i ddp-p v dd = 5.5 v ? 20 ? ma
page 266 2007-10-15 tmp91fw60 note 4: when designing the power supply, make sure that p eak currents can be supplied. in slow1 mode, the difference between the peak current and the average current becomes large. figure 15-1 intermittent operation of flash memory n program coutner (pc) n+1 n+2 n+3 1 machine cycle (4/fc or 4/fs) mcu current i [ma] ddp-p typ. current momentary flash current max. current sum of average momentary flash current and mcu current
page 267 2007-10-15 tmp91fw60 15.3 ac characteristics 15.3.1 v cc = 5.0 v 10% ac measuring conditions ? output level:high 0.7v cc /low 0.3v cc , cl = 50 pf ? input level:high 0.9v cc /low 0.1v cc note:symbol ?x? in the above table means the period of clock ?f fph ?, it?s half period of the system clock ?f sys ? for cpu core. the period of f fph depends on the clock gear setting or the selection of high-/low-oscillator fre- quency. no. parameter symbol variable f fph = 20mhz unit min max min max 1 f fph period ( = x) t fph 50.0 31250 50.0 ns 2 a0 to a15 valid ale falling t al 0.5 x ? 15 10 ns 3 ale falling a0 to a15 hold t la 0.5 x ? 15 10 ns 4 ale high pulse width t ll x ? 20 30 ns 5 ale falling rd / wr falling t lc 0.5 x ? 20 5 ns 6 rd rising ale rising t clr 0.5 x ? 15 10 ns 7 wr rising ale rising t clw x ? 15 35 ns 8 a0 to a15 valid rd / wr falling t acl x ? 25 25 ns 9 a0 to a21 valid rd / wr falling t ach 1.5 x ? 50 25 ns 10 rd rising a0 to a21 hold t car 0.5 x ? 20 5 ns 11 wr rising a0 to a21 hold t caw x ? 20 30 ns 12 a0 to a15 valid d0 to d15 input t adl 3.0 x ? 45 105 ns 13 a0 to a21 valid d0 to d15 input t adh 3.5 x ? 35 140 ns 14 rd falling d0 to d15 input t rd 2.0 x ? 40 60 ns 15 rd low pulse width t rr 2.0x ? 20 80 ns 16 rd rising d0 to d15 hold t hr 00ns 17 rd rising a0 to a15 output t rae x ? 15 35 ns 18 wr low pulse width t ww 1.5x ? 20 55 ns 19 d0 to d15 valid wr rising t dw 1.5x ? 50 25 ns 20 wr rising d0 to d15 hold t wd x ? 15 35 ns 21 a0 to a23 valid to wait input ((1 + n) wait mode) t awh 3.5x ? 90 85 ns 22 a0 to a15 valid to wait input ((1 + n) wait mode) t awl 3.0x ? 80 70 ns 23 wait hold after rd /wr asserted((1 + n) wait mode) t cw 2.0x + 0 100 ns 24 a0 to a21 valid port input t aph 3.5x ? 120 55 ns 25 a0 to a21 valid port hold t aph2 3.5x 175 ns 26 a0 to a21 valid port valid t ap 3.5x + 100 275 ns
page 268 2007-10-15 tmp91fw60 15.3.2 read cycle note: since the cpu accesses the internal area to read data from a port, the control signals of external pins such as rd and cs are not enabled. therefore, the above waveform diagram should be regarded as depicting internal operation. please also note that the timing and ac characterist ics of port input/output shown above are typi cal representation. for details, contact your local toshiba sales representative. figure 15-2 read cycle f fph a0~a23 cs0~cs3 r/w port input ad0~ad15 ale rd wait t fph t hr t car t aph t awh t awl t rae t cw t aph2 d0 ~d 15 a0 ~a 15 t al t ll t la t lc t rd t rr t clr t adh t adl t ach t acl
page 269 2007-10-15 tmp91fw60 15.3.3 write cycle note: since the cpu accesses the internal area to write dat a to a port, the control signals of external pins such as wa and cs are not enabled. therefore, the waveform diagram should be regarded as depicting internal operation. please also note that the timing and ac characteristics of port input/output shown above ar e typical representation. for details, contact your local toshiba sales representative. figure 15-3 write cycle f fph a0~a23 cs0~cs3 r/w port output h ) ad0~ad15 wait t wd t dw t caw t ww d0 ~d 15 wr, hwr a0 ~a 15 t ap ale t clw
page 270 2007-10-15 tmp91fw60 15.4 ad conversi on characteristics note 1: 1lsb = (v refh ? a vss )/1024 [v] note 2: the operation above is guaranteed for f fph 4 mhz. note 3: the value for i cc includes the current which flows through the a vcc pin. av cc = v cc , av ss = v ss parameter symbol variable min typ. max unit analog reference voltage ( + ) v refh v cc = 4.5 to 5.5 v v cc ? 1.5 v v cc v cc v analog reference voltage ( ? ) a vss v ss v ss v ss + 0.2 v v analog input voltage range v ain a vss v refh v analog current for analog reference voltage = 1 i ref (a vss = 0 v) 1.44 2.00 ma = 0 0.02 5.0 a error (not including quantizing errors) ? 1.0 4.0 lsb
page 271 2007-10-15 tmp91fw60 15.5 serial channel timi ng (i/o internal mode) 15.5.1 sclk input mode note: symbol ?x? in the above tabl e means the period of clock ?f fph ?, it?s half period of the system clock ?f sys ? for cpu core. the period of f fph depends on the clock gear setting or the selection of high-/low-oscillator frequency. 15.5.2 sclk output mode note 1: *: sclk rising/falling edge:the rising edge is used in sclk rising mode. the falling edge is used in sclk falling mode. note 2: 20 mhz and 16 mhz values are calculated from t scy = 16x case. note 3: symbol ?x? in the above table means the period of clock ?f fph ?, it?s half period of the system clock ?f sys ? for cpu core. the period of f fph depends on the clock gear setting or the se lection of high-/low-oscillator frequency. parameter symbol variable 20 mhz 16 mhz unit min max min max min max sclk period t scy 16x 800 1000 ns output data sclk rising/falling edge* t oss t scy /2 ? 4x ? 85 (v cc = 5v 10%) 115 165 ns sclk rising/falling edge* output data hold t ohs t scy /2 + 2x + 0 500 625 ns sclk rising/falling edge* input data hold t hsr 3x + 10 160 198 ns sclk rising/falling edge* valid data input* t srd t scy ? 0 800 1000 ns valid data input sclk rising/falling edge* t rds 000ns parameter symbol variable 20 mhz 16 mhz unit min max min max min max sclk period t scy 16x 8192x 0.8 410 1.0 512 s output data sclk rising/falling edge* t oss t scy /2 ? 40 360 460 ns sclk rising/falling edge* output data hold t ohs t scy /2 ? 40 360 460 ns sclk rising/falling edge* input data hold t hsr 000ns sclk rising/falling edge* valid data input t srd t scy ? 1x ? 90 660 847 ns valid data input sclk rising/falling edge* t rds 1x + 90 140 153 ns 0123 0123 valid valid valid valid output data txd input data rxd sclk (rising edge) sclk (falling edge) t oss t srd t scy t rds t hsr t ohs
page 272 2007-10-15 tmp91fw60 15.6 event counter ta0in, ta4in, tb0in0, tb0in1, tb1in0,tb1in1, tb2in0,tb2in1, tb3in0,tb3in1, tb4in0,tb4in1 note: symbol ?x? in the above tabl e means the period of clock ?f fph ?, it?s half period of the system clock ?f sys ? for cpu core. the period of f fph depends on the clock gear setting or the selection of high-/low-oscillator frequency. parameter symbol variable 20 mhz 16 mhz unit min max min max min max clock period t vck 8x + 100 500 600 ns clock low-level width t vckl 4x + 40 240 290 ns clock high-level width t vckh 4x + 40 240 290 ns
page 273 2007-10-15 tmp91fw60 15.7 interrupt and capture 15.7.1 nmi , int0 interrupts note: symbol ?x? in the above tabl e means the period of clock ?f fph ?, it?s half period of the system clock ?f sys ? for cpu core. the period of f fph depends on the clock gear setting or the selection of high-/low-oscillator frequency. 15.7.2 int1 to int10 interrupts, capture int1 to int10 input pulse width depend on the syst em clock selection and cloc k selection for prescaler. below table show pulse width of each operation clock. note 1: ?xc? shows period of clock fc in high frequency oscillator. note 2: symbol ?x? in the above table means the period of clock ?f fph ?, it?s half period of the system clock ?f sys ? for cpu core. the period of f fph depends on the clock gear setting or the se lection of high-/low-oscillator frequency. parameter symbol variable 20 mhz 16 mhz unit min max min max min max nmi, int0 low-level width t intal 4x + 40 240 290 ns nmi , int0 high-level width t intah 4x + 40 240 290 ns system clock selection syscr1 clock selection for prescaler syscr0 t intbl (int1 to int10 low level pulse width) t intbh (int1 to int10 high level pulse width) unit variable f fph = 20mhz variable f fph = 20 mhz min min min min 0 (fc) 0 (f fph ) 8x + 100 500 8x + 100 500 ns 1 (fc/16) 128xc + 0.1 6.5 128xc + 0.1 6.5 us 1 (fc) 0 (f fph ) 8x + 0.1 244.3 8x + 0.1 244.3
page 274 2007-10-15 tmp91fw60 15.8 scout pin ac characteristics note: t = period of scout measuring conditions output level: high = 0.7 v cc , low = 0.3 v cc , cl = 10 pf 15.9 flash characteristics 15.9.1 write/retenti on characteristics parameter symbol variable 20 mhz 16 mhz condition unit min max min max min max low-level width t sch 0.5t ? 15 10 16 v cc 4.5v ns high-level width t scl 0.5t ? 15 10 16 v cc 4.5v ns (v ss = 0 v) parameter condition min typ. max. unit number of guaranteed writes to flash memory v ss = 0 v fc = 4 to 20 mhz t opr = ? 10 to 40 c ?? 100 times t sch t scl scout
page 275 2007-10-15 tmp91fw60 15.10 recommended os cillating conditions the tmp91fw60 has been evaluated by the oscillator vende r below. use this information when selecting external parts. note 1: to ensure stable oscillation, the re sonator position, load capacitance, etc. must be appropriate. because these factors are greatly affected by board patterns, please be sure to evaluate operation on the board on which the device will actually be mounted. note 2: when using the device (oscillator) in places exposed to high elec tric fields such as cathode-ray tubes, we recommend electrically shielding the package in order to maintain normal operating condition. note 3: the product numbers and specifications of the resonators by murata manufacturing co., ltd. are subject to change. for up-to-date information, please refer to the following url: http://www.murata.co.jp/search/index.html x1 x2 c 2 rd c 1 xt1 xt2 c 2 rd c 1 (2) low-frequency oscillation (1) high-frequency oscillation
page 276 2007-10-15 tmp91fw60 16. table of sfr?s the special function registers (sfrs) include the i/o ports and peripheral cont rol registers allocated to the 4-kbyte address space from 000000h to 000fffh. 1. i/o ports 2. i/o port control 3. interrupt control 4. chip select/wait control 5. clock control 6. 8-bit timer 7. 16-bit timer 8. uart/serial channel 9. i 2 c bus interface 10. ad converter 11. watchdog timer 12. special timer for clock 13. program patch logic
page 277 2007-10-15 tmp91fw60 note: do not access to the unnamed addresses (e.g., addresses to which no register has been allocated). table 16-1 sfr address map (port, intc, cs/wait) [1]port address name address name address name 0000h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh p0 p1 p0cr p1cr p1fc p2 p2cr p2fc p3 p3fc2 p3cr p3fc 0010h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh p4 p4fc2 p4cr p4fc p5 p5cr p5fc p6 p6cr p6fc p7 p7cr p7fc 0020h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh p8 p8cr p8fc p9 p9cr p9fc pa pacr pafc pb pbfc2 pbcr pbfc [2]intc address name address name address name 0030h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh ode 0070h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh pz pzcr pzfc 0080h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh dma0v dma1v dma2v dma3v intclr dmar dmab iimc [3]cs/wait address name address name address name 0090h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh inte0ad inte12 inte34 inte56 inte78 inte910 inteta01 inteta23 inteta45 intetb0 intetb1 intetb2 intetb3 intetb4 intetb01v intetb23v 00a0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh intetb4vrtc intes0 intes1 intes2 intesbi01 intetc01 intetc23 00c0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh b0cs b1cs b2cs b3cs bexcs msar0 mamr0 msar1 mamr1 msar2 mamr2 msar3 mamr3
page 278 2007-10-15 tmp91fw60 note: do not access to the unnamed addresses (e.g., addresses to which no register has been allocated). table 16-2 sfr address map (cgear, tmra, tmrb) [4] cgear [5] tmra address name address name address name 00e0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh syscr0 syscr1 syscr2 emccr0 emccr1 00f0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh 0100h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh ta01run ta0reg ta1reg ta01mod ta1ffcr ta23run ta2reg ta3reg ta23mod ta3ffcr [6] tmrb address name address name address name 0110h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh ta45run ta4reg ta5reg ta45mod ta5ffcr 0180h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh tb0run tb0mod tb0ffcr tb0rg0l tb0rg0h tb0rg1l tb0rg1h tb0cp0l tb0cp0h tb0cp1l tb0cp1h 0190h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh tb1run tb1mod tb1ffcr tb1rg0l tb1rg0h tb1rg1l tb1rg1h tb1cp0l tb1cp0h tb1cp1l tb1cp1h address name address name address name 01a0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh tb2run tb2mod tb2ffcr tb2rg0l tb2rg0h tb2rg1l tb2rg1h tb2cp0l tb2cp0h tb2cp1l tb2cp1h 01b0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh tb3run tb3mod tb3ffcr tb3rg0l tb3rg0h tb3rg1l tb3rg1h tb3cp0l tb3cp0h tb3cp1l tb3cp1h 01c0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh tb4run tb4mod tb4ffcr tb4rg0l tb4rg0h tb4rg1l tb4rg1h tb4cp0l tb4cp0h tb4cp1l tb4cp1h
page 279 2007-10-15 tmp91fw60 note: do not access to the unnamed addresses (e.g., addresses to which no register has been allocated). table 16-3 sfr address map (uart/sio, i 2 c, adc, wdt, rtc, romc) [7] uart/sio [8] i 2 c address name address name address name 0200h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh sc0buf sc0cr sc0mod0 br0cr br0add sc0mod1 sc1buf sc1cr sc1mod0 br1cr br1add sc1mod1 0210h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh sc2buf sc2cr sc2mod0 br2cr br2add sc2mod1 0240h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh sbi0cr1 sbi0dbr i2c0ar sbi0cr2/sbi0sr sbi0br sbi0cr0 sbi1cr1 sbi1dbr i2c1ar sbi1cr2/sbi1sr sbi1br sbi1cr0 [9]10bit adc [10] wdt [11] rtc address name address name address name 02b0h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh adccr1 adccr2 adcdrl adcdrh 0300h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh wdmod wdcr 0310h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh rtccr [12] romc address name address name address name 0400h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh romcmp00 romcmp01 romcmp02 romsub0l romsub0h romcmp10 romcmp11 romcmp12 romsub1l romsub1h 0410h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh romcmp20 romcmp21 romcmp22 romsub2l romsub2h romcmp30 romcmp31 romcmp32 romsub3l romsub3h 0420h 1h 2h 3h 4h 5h 6h 7h 8h 9h ah bh ch dh eh fh romcmp40 romcmp41 romcmp42 romsub4l romsub4h romcmp50 romcmp51 romcmp52 romsub5l romsub5h
page 280 2007-10-15 tmp91fw60 (1) i/o ports symbol name address 7 6 5 4 3 2 1 0 p0 port 0 00h p07 p06 p05 p04 p03 p02 p01 p00 r/w data from external port (output latch register is undefined.) p1 port 1 01h p17 p16 p15 p14 p13 p12 p11 p10 r/w data from external port (output latch register is cleared to ?0?.) p2 port 2 06h p27 p26 p25 p24 p23 p22 p21 p20 r/w data from external port (output latch register is set to ?1?.) p3 port 3 0ch ????p33p32p31p30 ???? r/w ???? data from external port (output latch register is set to ?1?.) p4 port 4 10h ? ? ? p44 p43 p42 p41 p40 ??? r/w ??? data from external port (output latch register is set to ?1?.) ??? 0 (output latch register): pull-up resistor off 1 (output latch register): pull-up resistor on p5 port 5 14h p57 p56 p55 p54 p53 p52 p51 p50 r/w data from external port (output latch register is set to ?1?.) p6 port 6 18h p67 p66 p65 p64 p63 p62 p61 p60 r/w data from external port (output latch register is set to ?1?.) p7 port 7 1ch ? ? p75 p74 p73 p72 p71 p70 ?? ? ? ? data from external port (outpu t latch register is set to ?1?.) p8 port 8 20h p87 p86 p85 p84 p83 p82 p81 p80 r/w data from external port (output latch register is set to ?1?.) p9 port 9 24h p97 p96 p95 p94 p93 p92 p91 p90 r/w data from external port (output latch register is set to ?1?.) pa port a 28h ? ? ? ? pa3 pa2 pa1 pa0 ???? r/w ???? data from external port (output latch register is set to ?1?.) pb port b 2ch ? ? ? ? pb3 pb2 pb1 pb0 ???? r/w ???? data from external port (output latch register is set to ?1?.) pz port z 7dh ? ? ? ? pz3 pz2 pz1 pz0 ???? r/w ???? data from external port (output latch register is set to ?1?.) 11 0 (output latch register): pull-up resistor off 1 (output latch register): pull-up resistor on output mode
page 281 2007-10-15 tmp91fw60 (2) i/o port control symbol name address 7 6 5 4 3 2 1 0 p0cr port 0 control 02h (rmw instruc- tions are pro- hibited.) p07c p06c p05c p04c p03c p02c p01c p00c w 00000000 0: input 1: output (when access to external, become ad7 to ad0 and this register is cleared to ?0?.) p1cr port 1 control 04h (rmw instruc- tions are pro- hibited.) p17c p16c p15c p14c p13c p12c p11c p10c w 00000000 <> p1fc port 1 function 05h (rmw instruc- tions are pro- hibited.) p17f p16f p15f p14f p13f p12f p11f p10f w 00000000 p1fc/p1cr = 00: input, 01: output, 10: ad15 to ad8, 11: a15 to a8 p2cr port 2 control 08h (rmw instruc- tions are pro- hibited.) p27c p26c p25c p24c p23c p22c p21c p20c w 00000000 <> p2fc port 2 function 09h (rmw instruc- tions are pro- hibited.) p27f p26f p25f p24f p23f p22f p21f p20f w 00000000 p2fc/p2cr = 00: input, 01: output, 10: a7 to a0, 11: a23 to a16 p3cr port 3 control 0eh (rmw instruc- tions are pro- hibited.) ? ? ? ? p33c p32c p31c p30c ???? w ????0000 ???? <> <> p3fc port 3 function 0fh (rmw instruc- tions are pro- hibited.) ? ? ? ? p33f p32f p31f p30f ???? w ????0000 ???? p33f/ p33c= 00:input port 01:output port 11: tb3out1 p32f/ p32c= 00:input port 01:output port 10: wait 11: tb3out0 <> p3fc2 port 3 function 2 0dh (rmw instruc- tions are pro- hibited.) ??????p31f2p30f2 ?????? w ??????00 ?????? p31f2/ p31f/ p31c= 000:input port 001:output port 010: tb3in1 /int4 101: scl0 p30f2/ p30f/ p30c= 000:input port 001:output port 010: tb3in0 /int3 101: sda0
page 282 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 p4cr port 4 control 12h (rmw instruc- tions are pro- hibited.) ? ? ? p44c p43c p42c p41c p40c ??? w ???00000 ? ? ? <> p4fc port 4 function 13h (rmw instruc- tions are pro- hibited.) ? ? ? p44f p43f p42f p41f p40f ??? w ???00000 ? ? ? <> p4fc2 port 4 function 2 11h (rmw instruc- tions are pro- hibited.) ? ? ? ? p43f2 ? p41f2 p40f2 ????w? w ????0?00 ??? p44f,p44c= 00: input port 01: output prort 11:ale p43f2,p43f ,p43c= 000 :input port 001:output port 011:cs3 101:sclk2 p42f,p42c= 00: input port 01: output port 11:cs2 p41f2,p41f , p41c = 000: input port 001: output port 011:cs1 101:txd2 p40f2,p40f , p40c = 000: input port 001:output port 011: cs0 101: scout p5cr port 5 control 16h (rmw instruc- tions are pro- hibited.) p57c p56c p55c p54c p53c p52c p51c p50c w 00000000 0: input 1: output p5fc port 5 function 17h (rmw instruc- tions are pro- hibited.) p57f p56f p55f p54f p53f p52f p51f p50f w 00000000 p57 input 0: disable 1: enable p56 input 0: disable 1: enable p55 input 0: disable 1: enable p54 input 0: disable 1: enable p53 input 0: disable 1: enable p52 input 0: disable 1: enable p51 input 0: disable 1: enable p50 input 0: disable 1: enable p6cr port 6 control 1ah (rmw instruc- tions are pro- hibited.) p67c p66c p65c p64c p63c p62c p61c p60c w 00000000 0: input 1: output p6fc port 6 function 1bh (rmw instruc- tions are pro- hibited.) p67f p66f p65f p64f p63f p62f p61f p60f w 00000000 p67 input 0: disable 1: enable p66 input 0: disable 1: enable p65 input 0: disable 1: enable p64 input 0: disable 1: enable p63 input 0: disable 1: enable p62 input 0: disable 1: enable p61 input 0: disable 1: enable p60 input 0: disable 1: enable p7cr port 7 control 1eh (rmw instruc- tions are pro- hibited.) ? ? p75c p74c p73c p72c p71c p70c ?? w ??000000 ? ? 0: input 1: output p7fc port 7 function 1fh (rmw instruc- tions are pro- hibited.) ? ? p75f p74f ? p72f p71f ? ??w?w? ??00?00? ?? 0: port 1: int0 0: port 1: ta5out ? 0: port 1: ta3out 0: port 1: ta1out ?
page 283 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 p8cr port 8 control 22h (rmw instruc- tions are pro- hibited.) p87c p86c p85c p84c p83c p82c p81c p80c w 00000000 0: input 1: output p8fc port 8 function 23h (rmw instruc- tions are pro- hibited.) p87f p86f p85f p84f p83f p82f p81f p80f w 00000000 0: port 1: tb1out1 0: port 1: tb1out0 0: port 1: tb1in1, int8 0: port 1: tb1in0, int7 0: port 1: tb0out1 0: port 1: tb0out0 0: port 1: tb0in1, int6 0: port 1: tb0in0, int5 p9cr port 9 control 26h (rmw instruc- tions are pro- hibited.) p97c p96c p95c p94c p93c p92c p91c p90c w 11000000 0: input 1: output p9fc port 9 function 27h (rmw instruc- tions are pro- hibited.) p97f p96f p95f ? p93f p92f ? p90f w?w?w 000?00?0 port 0: disable 1: enable port 0: disable 1: enable 0: port 1: sclk1 output ? 0: port 1: txd1 output 0: port 1: sclk0 output ? 0: port 1: txd0 output pacr port a control 2ah (rmw instruc- tions are pro- hibited.) ? ? ? ? pa3c pa2c pa1c pa0c ???? w ????0000 ? ? ? ? 0: input 1: output pafc port a function 2bh (rmw instruc- tions are pro- hibited.) ? ? ? ? pa3f pa2f pa1f pa0f ???? w ????0000 ???? 0: port 1: tb2out1 0:port 1: tb2out0 0: port 1: tb2in1, int2 0: port 1: tb2in0, int1 pbcr port b control 2eh (rmw instruc- tions are pro- hibited.) ? ? ? ? pb3c pb2c pb1c pb0c ???? w ????0000 ? ? ? ? <> pbfc port b function 2fh (rmw instruc- tions are pro- hibited.) ? ? ? ? pb3f pb2f pb1f pb0f ???? w ????0000 ? ? ? ? <> pbfc2 port b function 2 2dh (rmw instruc- tions are pro- hibited.) ??????pb1f2pb0f2 ?????? w ??????00 ???? pb3f, pb3c = 00: input port 01: output port 11: tb4out1 pb2f, pb2c = 00: input port 01: output port 11: tb4out0 pb1f2,pb1 f, p b 1 c = 000: input port 001: output port 010: tb4in1 /int10 101: scl1 pb0f2,pb0 f, pb0c = 000: input port 001:output port 010: tb4in0 /int9 101: sda1
page 284 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 pzcr port z control 7eh (rmw instruc- tions are pro- hibited.) ? ? ? ? pz3c pz2c ? ? ???? w ?? ????00?? ? ? ? ? 0:input 1:output ? ? pzfc port z function 7fh (rmw instruc- tions are pro- hibited.) ? ? ? ? pz3f pz2f pz1f pz0f ???? w ????0000 ???? 0: port 1:r/ w 0: port 1: hwr 0: port 1: wr 0: port 1: rd ode open-drain control register 3fh ? odeb1 odeb0 ode93 ode90 ode41 ode31 ode30 ?r/w ?0000000 ? 0: cmos output 1:open drain output
page 285 2007-10-15 tmp91fw60 (3) interrupt control symbol name address 7 6 5 4 3 2 1 0 inte0ad interrupt enable 0 & ad 90h intad int0 iadc iadm2 iadm1 iadm0 i0c i0m2 i0m1 i0m0 rr/wrr/w 00000000 1: intad interrput level 1: int0 interrput level inte12 interrupt enable 2 / 1 91h int2 int1 i2c i2m2 i2m1 i2m0 i1c i1m2 i1m1 i1m0 rr/wrr/w 00000000 1: int2 interrput level 1: int1 interrput level inte34 interrupt enable 4 / 3 92h int4 int3 i4c i4m2 i4m1 i4m0 i3c i3m2 i3m1 i3m0 rr/wrr/w 00000000 1: int4 interrput level 1: int3 interrput level inte56 interrupt enable 6 / 5 93h int6 int5 i6c i6m2 i6m1 i6m0 i5c i5m2 i5m1 i5m0 rr/wrr/w 00000000 1: int6 interrput level 1: int5 interrput level inte78 interrupt enable 8 / 7 94h int8 int7 i8c i8m2 i8m1 i8m0 i7c i7m2 i7m1 i7m0 rr/wrr/w 00000000 1: int8 interrput level 1: int7 interrput level inte910 interrupt enable 10 / 9 95h int10 int9 i10c i10m2 i10m1 i10m0 i9c i9m2 i9m1 i9m0 rr/wrr/w 00000000 1: int10 interrput level 1: int9 interrput level inteta01 interrupt enable timer a 1 / 0 96h intta1(tmra1) intta0 (tmra0) ita1c ita1m2 ita1m1 ita1m0 ita0c ita0m2 ita0m1 ita0m0 rr/wrr/w 00000000 1: intta1 interrput level 1: intta0 interrput level inteta23 interrupt enable timer a 3 / 2 97h intta3 (tmra3) intta2 (tmra2) ita3c ita3m2 ita3m1 ita3m0 ita2c ita2m2 ita2m1 ita2m0 rr/wrr/w 00000000 1: intta3 interrput level 1: intta2 interrput level inteta45 interrupt enable timer a 5 / 4 98h intta5 (tmra5) intta4 (tmra4) ita5c ita5m2 ita5m1 ita5m0 ita4c ita4m2 ita4m1 ita4m0 rr/wrr/w 00000000 1: intta5 interrput level 1: intta4 interrput level
page 286 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 intetb0 interrupt enable tmrb 0 99h inttb01(tmrb0) inttb00(tmrb0) itb01c itb01m2 itb01m1 itb01m0 itb00c itb00m2 itb00m1 itb00m0 rr/wrr/w 00000000 1: inttb01 interrput level 1: inttb00 interrput level intetb1 interrupt enable tmrb 1 9ah inttb11(tmrb1) inttb10(tmrb1) itb11c itb11m2 itb11m1 itb11m0 itb10c itb10m2 itb10m1 itb10m0 rr/wrr/w 00000000 1: inttb11 interrput level 1: inttb10 interrput level intetb2 interrupt enable tmrb 2 9bh inttb21(tmrb2) inttb20(tmrb2) itb21c itb21m2 itb21m1 itb21m0 itb20c itb20m2 itb20m1 itb20m0 rr/wrr/w 00000000 1: inttb21 interrput level 1: inttb20 interrput level intetb3 interrupt enable tmrb 3 9ch inttb31(tmrb3) inttb30(tmrb3) itb31c itb31m2 itb31m1 itb31m0 itb30c itb30m2 itb30m1 itb30m0 rr/wrr/w 00000000 1: inttb31 interrput level 1: inttb30 interrput level intetb4 interrupt enable tmrb 4 9dh inttb41(tmrb4) inttb40(tmrb4) itb41c itb41m2 itb41m1 itb41m0 itb40c itb40m2 itb40m1 itb40m0 rr/wrr/w 00000000 1: inttb41 interrput level 1: inttb40 interrput level intetb01v interrupt enable tmrb 0/1 (over flow) 9eh inttbof1(tmrb1 over flow) inttbof1(tmrb0 over flow) itf1c itf1m2 itf1m1 itf1m0 itf0c itf0m2 itf0m1 itf0m0 rr/wrr/w 00000000 1: inttbof1 interrput level 1:inttbof0 interrput level intetb23v interrupt enable tmrb 2/3 (over flow) 9fh inttbof3(tmrb3 over flow) inttbof2(tmrb2 over flow) itf3c itf3m2 itf3m1 itf3m0 itf2c itf2m2 itf2m1 itf2m0 rr/wrr/w 00000000 1: inttbof3 interrput level 1:inttbof2 interrput level intetb4vrtc interrupt enable tmrb4 (over flow) / intrtc a0h intrtc inttbof4(tmrb4 over flow) irtcc irtcm2 irtcm1 irtcm0 itf4c itf4m2 itf4m1 itf4m0 rr/wrr/w 00000000 1: intrtc interrput level 1:inttbof4 interrput level
page 287 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 intes0 interrupt enable serial 0 a1h inttx0 intrx0 itx0c itx0m2 itx0m1 itx0m0 irx0c irx0m2 irx0m1 irx0m0 rr/wrr/w 00000000 1: inttx0 interrput level 1: intrx0 interrput level intes1 interrupt enable serial 1 a2h inttx1 intrx1 itx1c itx1m2 itx1m1 itx1m0 irx1c irx1m2 irx1m1 irx1m0 rr/wrr/w 00000000 1: inttx1 interrput level 1: intrx1 interrput level intes2 interrupt enable serial 2 a3h inttx2 intrx2 itx2c itx2m2 itx2m1 itx2m0 irx0c irx2m2 irx2m1 irx2m0 rr/wrr/w 00000000 1: inttx2 interrput level 1: intrx2 interrput level intesbi01 interrupt enable sbi 0/1 a4h intsbi1 intsbi0 isbi1c isbi1m2 isbi1m1 isbi1m0 isbi0c isbi0m2 isbi0m1 isbi0m0 rr/wrr/w 00000000 1: intsbi1 interrput level 1: intsbi0 interrput level intetc01 interrupt enable tc 0/1 a5h inttc1 inttc0 itc1c itc1m2 itc1m1 itc1m0 itc0c itc0m2 itc0m1 itc0m0 rr/wrr/w 00000000 1: inttc1 interrput level 1: inttc0 interrput level intetc23 interrupt enable tc 2/3 a6h inttc3 inttc2 itc3c itc3m2 itc3m1 itc3m0 itc2c itc2m2 itc2m1 itc2m0 rr/wrr/w 00000000 1: inttc3 interrput level 1: inttc2 interrput level
page 288 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 dma0v dma0 start vector 80h ?? dma0v5 dma0v4 dma0v3 dma0v2 dma0v1 dma0v0 ?? r/w ?? 000000 ?? dma0 start vector dma1v dma1 start vector 81h ?? dma1v5 dma1v4 dma1v3 dma1v2 dma1v1 dma1v0 ?? r/w ?? 000000 ?? dma1 start vector dma2v dma2 start vector 82h ?? dma2v5 dma2v4 dma2v3 dma2v2 dma2v1 dma2v0 ?? r/w ?? 000000 ?? dma2 start vector dma3v dma3 start vector 83h ?? dma3v5 dma3v4 dma3v3 dma3v2 dma3v1 dma3v0 ?? r/w ?? 000000 ?? dma3 start vector intclr interrupt clear control 88h (rmw instruc- tions are pro- hibited.) ?? clrv5 clrv4 clrv3 clrv2 clrv1 clrv0 ?? w ?? 000000 ?? interrupt vector dmar dma software request register 89h (rmw instruc- tions are pro- hibited.) ???? dmar3 dmar2 dmar1 dmar0 ???? r/w ???? 0000 ???? 1: dma software request dmab dma burst register 8ah ???? dmab3 dmab2 dmab1 dmab0 ???? r/w ???? 0000 ???? 1: dma burst request iimc interrupt input mode control 8ch (rmw instruc- tions are pro- hibited.) ????? i0edge i0le nmiree w 00000000 always write ?0?. ???? int0 edge 0: rising 1: falling int0 mode 0: edge 1: level 1:oper- ates even on rising/ falling edge of nmi
page 289 2007-10-15 tmp91fw60 (4) chip select / wait control symbol name address 7 6 5 4 3 2 1 0 b0cs block 0 cs/wait control register c0h (rmw instruc- tions are pro- hibited.) b0e ? b0om1 b0om0 b0bus b0w2 b0w1 b0w0 w ? w 0 ? 000000 0: disable 1: enable ? chip select output wave- form selection 00: for rom/sram 01: don?t care 10: don?t care 11: don?t care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait b1cs block 1 cs/wait control register c1h (rmw instruc- tions are pro- hibited.) b1e ? b1om1 b1om0 b1bus b1w2 b1w1 b1w0 w ? w 0 ? 000000 0: disable 1: enable ? chip select output wave- form selection 00: for rom/sram 01: don?t care 10: don?t care 11: don?t care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait b2cs block 2 cs/wait control register c2h (rmw instruc- tions are pro- hibited.) b2e b2m b2om1 b2om0 b2bus b2w2 b2w1 b2w0 w 10000000 0: disable 1: enable cs2 area selection 0:16mbyte area 1: cs area chip select output wave- form selection 00: rom/sram 01: don't care 10: don't care 11: don't care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait b3cs block 3 cs/wait control register c3h (rmw instruc- tions are pro- hibited.) b3e ? b3om1 b3om0 b3bus b3w2 b3w1 b3w0 w ? w 0 ? 000000 0: disable 1: enable ? chip select output wave- form selection 00: for rom/sram 01: don?t care 10: don?t care 11: don?t care data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait bexcs external cs/wait control register c7h (rmw instruc- tions are pro- hibited.) ???? bexbus bexw2 bexw1 bexw0 ? ? ?? w ?? ?? 0000 ???? data bus width 0: 16 bits 1: 8 bits number of waits 000: 2 wait 100: reserved 001: 1 wait 101: 3 wait 010: 1 wait+n 110: 4 wait 011: 0 wait 111: 8 wait
page 290 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 msar0 memory address register 0 c8h s23 s22 s21 s20 s19 s18 s17 s16 r/w 11111111 determine a23 to a16 of start address mamr0 memory address mask register 0 c9h v20 v19 v18 v17 v16 v15 v14~v9 v8 r/w 11111111 set size of cs0 area 0: used for address compare msar1 memory address register 1 cah s23 s22 s21 s20 s19 s18 s17 s16 r/w 11111111 determine a23 to a16 of start address mamr1 memory address mask register 1 cbh v21 v20 v19 v18 v17 v16 v15~v9 v8 r/w 11111111 set size of cs1 area 0: used for address compare msar2 memory address register 2 cch s23 s22 s21 s20 s19 s18 s17 s16 r/w 11111111 determine a23 to a16 of start address mamr2 memory address mask register 2 cdh v22 v21 v20 v19 v18 v17 v16 v15 r/w 11111111 set size of cs2 area 0: used for address compare msar3 memory address register 3 ceh s23 s22 s21 s20 s19 s18 s17 s16 r/w 11111111 determine a23 to a16 of start address mamr3 memory address mask register 3 cfh v22 v21 v20 v19 v18 v17 v16 v15 r/w 11111111 set size of cs3 area 0: used for address compare
page 291 2007-10-15 tmp91fw60 (5) clock control symbol name address 7 6 5 4 3 2 1 0 syscr0 system clock control register 0 e0h xen xten rxen rxten rsysck wuef prck1 ? r/w ? 1010000? high- frequency oscillator 0:stop 1:oscilla- tion low- frequency oscillator 0:stop 1:oscilla- tion high- frequency oscillator (fc) after release of stop mode 0:stop 1:oscilla- tion low- frequency oscillator (fs) after release of stop mode 0:stop 1:oscilla- tion selects clock after release of stop mode 0:fc 1:fs warm-up timer con- trol 0 write: don't care 1 write: start warm-up 0 read: end warm- up 1 read: do not end warm-up select prescaler clock 0:f fph 1:fc/16 ? syscr1 system clock control register 1 e1h ? ? ? ? sysck gear2 gear2 gear2 ???? r/w ????0000 ???? select sys- tem clock 0: fc 1: fs select gear value of high frequency (fc) 000:fc 001:fc/2 010:fc/4 011:fc/8 100:fc/16 101:reserved 110:reserved 111:reserved syscr2 system clock control register 1 e2h ? scosel wuptm1 wuptm0 haltm1 haltm0 ? drve ?r/w?r/w ?01011?0 ? select scout 0:fs 1:f sys select warm-up time for oscillator 00:2 18 /inputted fre- quency 01:2 8 /inputted frequency 10:2 14 /inputted fre- quency 11:2 16 /inputted fre- quency halt mode 00:reserved 01:stop mode 10:idle1 mode 11:idle2 mode ? pin state control in stop mode 0: i/o off 1:remains the state before halt emccr0 emc control register 0 e3h protect??????? rr/w 00100011 protect flag 0:off 1:on write "0". write "1". write "0". write "0". write "0". write "1". write "1". emccr1 emc control register 1 e4h protect off by writing "1fh". protect on by writing except "1fh".
page 292 2007-10-15 tmp91fw60 (6) 8-bit timer symbol name address 7 6 5 4 3 2 1 0 ta01run 8-bit timer run 100h ta0rde ? ? ? i2ta01 ta01prun ta1run ta0run r/w ? ? ? r/w 0???0000 double buffer 0: disable 1: enable ??? idle2 0: stop 1: operate tmra01 prescaler up counter (uc1) up counter (uc0) 0: stop and clear 1: run (count up) ta0reg 8-bit timer register 0 102h (rmw instruc- tions are pro- hibited.) ? w 0 ta1reg 8-bit timer register 1 103h (rmw instruc- tions are pro- hibited.) ? w 0 ta01mod 8-bit timer source clk & mode 104h ta01m1 ta01m0 pwm01 pwm00 ta1clk1 ta1clk0 ta0clk1 ta0clk0 r/w 00000000 operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 input clock for tmra1 00: ta0trg 01: t1 10: t16 11: t256 input clock for tmra0 00: ta0in pin 01: t1 10: t4 11: t16 ta1ffcr 8-bit timer frip-flop control 105h ? ? ? ? ta1ffc1 ta1ffc0 ta1ffie ta1ffis ???? r/w ????1100 ???? 00: invert ta1ff 01: set ta1ff 10: clear ta1ff 11: don?t care ta1ff control for inversion 0: disable 1: enable ta1ff inversion select 0: tmra0 1: tmra1
page 293 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 ta23run 8-bit timer run 108h ta2rde ? ? ? i2ta23 ta23prun ta3run ta2run r/w ? ? ? r/w 0???0000 double buffer 0: disable 1: enable ??? idle2 0: stop 1: operate tmra23 prescaler up counter (uc3) up counter (uc2) 0: stop and clear 1: run (count up) ta2reg 8-bit timer register 0 10ah (rmw instruc- tions are pro- hibited.) ? w 0 ta3reg 8-bit timer register 1 10bh (rmw instruc- tions are pro- hibited.) ? w 0 ta23mod 8-bit timer source clk & mode 10ch ta23m1 ta23m0 pwm21 pwm20 ta3clk1 ta3clk0 ta2clk1 ta2clk0 r/w 00000000 operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 input clock for tmra3 00: ta2trg 01: t1 10: t16 11: t256 input clock for tmra2 00: reserved 01: t1 10: t4 11: t16 ta3ffcr 8-bit timer frip-flop control 10dh ? ? ? ? ta3ffc1 ta3ffc0 ta3ffie ta3ffis ???? r/w ????1100 ???? 00: invert ta3ff 01: set ta3ff 10: clear ta3ff 11: don?t care ta3ff control for inversion 0: disable 1: enable ta3ff inversion select 0: tmra2 1: tmra3
page 294 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 ta45run 8-bit timer run 110h ta4rde ? ? ? i2ta45 ta45prun ta5run ta4run r/w ? ? ? r/w 0???0000 double buffer 0: disable 1: enable ??? idle2 0: stop 1: operate tmra45 prescaler up counter (uc5) up counter (uc4) 0: stop and clear 1: run (count up) ta4reg 8-bit timer register 0 112h (rmw instruc- tions are pro- hibited.) ? w 0 ta5reg 8-bit timer register 1 113h (rmw instruc- tions are pro- hibited.) ? w 0 ta45mod 8-bit timer source clk & mode 114h ta45m1 ta45m0 pwm41 pwm40 ta5clk1 ta5clk0 ta4clk1 ta4clk0 r/w 00000000 operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit ppg mode 11: 8-bit pwm mode pwm cycle 00: reserved 01: 2 6 10: 2 7 11: 2 8 input clock for tmra5 00: ta4trg 01: t1 10: t16 11: t256 input clock for tmra4 00: ta4in pin 01: t1 10: t4 11: t16 ta5ffcr 8-bit timer frip-flop control 115h ? ? ? ? ta5ffc1 ta5ffc0 ta5ffie ta5ffis ???? r/w ????1100 ???? 00: invert ta5ff 01: set ta5ff 10: clear ta5ff 11: don?t care ta5ff control for inversion 0: disable 1: enable ta5ff inversion select 0: tmra4 1: tmra5
page 295 2007-10-15 tmp91fw60 (7) 16-bit timer symbol name address 7 6 5 4 3 2 1 0 tb0run 16-bit timer control 180h tb0rde ? ? ? i2tb0 tb0prun ? tb0run r/w ? ? r/w ? r/w 00??00?0 double buffer 0: disable 1: enable always write 0. ?? idle2 0: stop 1: operate tmrb0 prescaler ? up counter (uc0) 0: stop and clear 1: run (count up) tb0mod 16-bit timer source clk & mode 182h (rmw instruc- tions are pro- hibited.) tb0ct1 tb0et1 tb0cp0i tb0cpm1 tb0cpm0 tb0cle tb0clk1 tb0clk0 r/w w* r/w 00100000 tb0ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: unde- fined capture timing 00: disable int5 occurs at rising edge 01: tb0in0 tb0in1 int5 occurs at rising edge 10: tb0in0 tb0in0 int5 occurs at falling edge 11: ta1out ta1out int5 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb0 input clock select 00: tb0in0 pin input 01: t1 10: t4 11: t16 invert when uc0 is loaded into tb0cp1h/l invert when uc0 matches with tb0rg1h/l tb0ffcr 16-bit timer frip-flop control 183h (rmw instruc- tions are pro- hibited.) tb0ff1c1 tb0ff1c0 tb0c1t1 tb0c0t1 tb0e1t1 tb0e0t1 tb0ff0c1 tb0ff0c0 w* r/w w* 11000011 tb0ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb0ff0 inversion trigger 0: disable 1: enable tb0ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc0 is loaded into tb0cp1h/l. invert when uc0 is loaded into tb0cp0h/l. invert when uc0 matches tb0rg1h/l. invert when uc0 matches tb0rg0h/l. tb0rg0l 16-bit timer register 0l 188h (rmw instruc- tions are pro- hibited.) ? w undefined tb0rg0h 16-bit timer register 0h 189h (rmw instruc- tions are pro- hibited.) ? w undefined tb0rg1l 16-bit timer register 1l 18ah (rmw instruc- tions are pro- hibited.) ? w undefined tb0rg1h 16-bit timer register 1h 18bh (rmw instruc- tions are pro- hibited.) ? w undefined tb0cp0l capture register 0l 18ch ? r undefined tb0cp0h capture register 0h 18dh ? r undefined tb0cp1l capture register 1l 18eh ? r undefined tb0cp1h capture register 1h 18fh ? r undefined
page 296 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 tb1run 16-bit timer control 190h tb1rde ? ? ? i2tb1 tb1prun ? tb1run r/w ? ? r/w ? r/w 00??00?0 double buffer 0: disable 1: enable always write 0. ?? idle2 0: stop 1: operate tmrb1 prescaler ? up counter (uc1) 0: stop and clear 1: run (count up) tb1mod 16-bit timer source clk & mode 192h (rmw instruc- tions are pro- hibited.) tb1ct1 tb1et1 tb1cp0i tb1cpm1 tb1cpm0 tb1cle tb1clk1 tb1clk0 r/w w* r/w 00100000 tb1ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: unde- fined capture timing 00: disable int7 occurs at rising edge 01: tb1in0 tb1in1 int7 occurs at rising edge 10: tb1in0 tb1in0 int7 occurs at falling edge 11: ta1out ta1out int7 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb1 input clock select 00: tb1in0 pin input 01: t1 10: t4 11: t16 invert when uc1 is loaded into tb1cp1h/l invert when uc1 matches with tb1rg1h/l tb1ffcr 16-bit timer frip-flop control 193h (rmw instruc- tions are pro- hibited.) tb1ff1c1 tb1ff1c0 tb1c1t1 tb1c0t1 tb1e1t1 tb1e0t1 tb1ff0c1 tb1ff0c0 w* r/w w* 11000011 tb1ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb1ff0 inversion trigger 0: disable 1: enable tb1ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc1 is loaded into tb1cp1h/l. invert when uc1 is loaded into tb1cp0h/l. invert when uc1 matches tb1rg1h/l. invert when uc1 matches tb1rg0h/l. tb1rg0l 16-bit timer register 0l 198h (rmw instruc- tions are pro- hibited.) ? w undefined tb1rg0h 16-bit timer register 0h 199h (rmw instruc- tions are pro- hibited.) ? w undefined tb1rg1l 16-bit timer register 1l 19ah (rmw instruc- tions are pro- hibited.) ? w undefined tb1rg1h 16-bit timer register 1h 19bh (rmw instruc- tions are pro- hibited.) ? w undefined tb1cp0l capture register 0l 19ch ? r undefined tb1cp0h capture register 0h 19dh ? r undefined tb1cp1l capture register 1l 19eh ? r undefined tb1cp1h capture register 1h 19fh ? r undefined
page 297 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 tb2run 16-bit timer control 1a0h tb2rde ? ? ? i2tb2 tb2prun ? tb2run r/w ? ? r/w ? r/w 00??00?0 double buffer 0: disable 1: enable always write 0. ?? idle2 0: stop 1: operate tmrb2 prescaler ? up counter (uc2) 0: stop and clear 1: run (count up) tb2mod 16-bit timer source clk & mode 1a2h (rmw instruc- tions are pro- hibited.) tb2ct1 tb2et1 tb2cp0i tb2cpm1 tb2cpm0 tb2cle tb2clk1 tb2clk0 r/w w* r/w 00100000 tb2ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: unde- fined capture timing 00: disable int1 occurs at rising edge 01: tb2in0 tb2in1 int1 occurs at rising edge 10: tb2in0 tb2in0 int1 occurs at falling edge 11: ta1out ta1out int1 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb2 input clock select 00: tb2in0 pin input 01: t1 10: t4 11: t16 invert when uc2 is loaded into tb2cp1h/l invert when uc2 matches with tb2rg1h/l tb2ffcr 16-bit timer frip-flop control 1a3h (rmw instruc- tions are pro- hibited.) tb2ff1c1 tb2ff1c0 tb2c1t1 tb2c0t1 tb2e1t1 tb2e0t1 tb2ff0c1 tb2ff0c0 w* r/w w* 11000011 tb2ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb2ff0 inversion trigger 0: disable 1: enable tb2ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc2 is loaded into tb2cp1h/l. invert when uc2 is loaded into tb2cp0h/l. invert when uc2 matches tb2rg1h/l. invert when uc2 matches tb2rg0h/l. tb2rg0l 16-bit timer register 0l 1a8h (rmw instruc- tions are pro- hibited.) ? w undefined tb2rg0h 16-bit timer register 0h 1a9h (rmw instruc- tions are pro- hibited.) ? w undefined tb2rg1l 16-bit timer register 1l 1aah (rmw instruc- tions are pro- hibited.) ? w undefined tb2rg1h 16-bit timer register 1h 1abh (rmw instruc- tions are pro- hibited.) ? w undefined tb2cp0l capture register 0l 1ach ? r undefined tb2cp0h capture register 0h 1adh ? r undefined tb2cp1l capture register 1l 1aeh ? r undefined tb2cp1h capture register 1h 1afh ? r undefined
page 298 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 tb3run 16-bit timer control 1b0h tb3rde ? ? ? i2tb3 tb3prun ? tb3run r/w ? ? r/w ? r/w 00??00?0 double buffer 0: disable 1: enable always write 0. ?? idle2 0: stop 1: operate tmrb3 prescaler ? up counter (uc3) 0: stop and clear 1: run (count up) tb3mod 16-bit timer source clk & mode 1b2h (rmw instruc- tions are pro- hibited.) tb3ct1 tb3et1 tb3cp0i tb3cpm1 tb3cpm0 tb3cle tb3clk1 tb3clk0 r/w w* r/w 00100000 tb3ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: unde- fined capture timing 00: disable int3 occurs at rising edge 01: tb3in0 tb3in1 int3 occurs at rising edge 10: tb3in0 tb3in0 int3 occurs at falling edge 11: ta3out ta3out int3 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb3 input clock select 00: tb3in0 pin input 01: t1 10: t4 11: t16 invert when uc3 is loaded into tb3cp1h/l invert when uc3 matches with tb3rg1h/l tb3ffcr 16-bit timer frip-flop control 1b3h (rmw instruc- tions are pro- hibited.) tb3ff1c1 tb3ff1c0 tb3c1t1 tb3c0t1 tb3e1t1 tb3e0t1 tb3ff0c1 tb3ff0c0 w* r/w w* 11000011 tb3ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb3ff0 inversion trigger 0: disable 1: enable tb3ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc3 is loaded into tb3cp1h/l. invert when uc3 is loaded into tb3cp0h/l. invert when uc3 matches tb3rg1h/l. invert when uc3 matches tb3rg0h/l. tb3rg0l 16-bit timer register 0l 1b8h (rmw instruc- tions are pro- hibited.) ? w undefined tb3rg0h 16-bit timer register 0h 1b9h (rmw instruc- tions are pro- hibited.) ? w undefined tb3rg1l 16-bit timer register 1l 1bah (rmw instruc- tions are pro- hibited.) ? w undefined tb3rg1h 16-bit timer register 1h 1bbh (rmw instruc- tions are pro- hibited.) ? w undefined tb3cp0l capture register 0l 1bch ? r undefined tb3cp0h capture register 0h 1bdh ? r undefined tb3cp1l capture register 1l 1beh ? r undefined tb3cp1h capture register 1h 1bfh ? r undefined
page 299 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 tb4run 16-bit timer control 1c0h tb4rde ? ? ? i2tb4 tb4prun ? tb4run r/w ? ? r/w ? r/w 00??00?0 double buffer 0: disable 1: enable always write 0. ?? idle2 0: stop 1: operate tmrb4 prescaler ? up counter (uc4) 0: stop and clear 1: run (count up) tb4mod 16-bit timer source clk & mode 1c2h (rmw instruc- tions are pro- hibited.) tb4ct1 tb4et1 tb4cp0i tb4cpm1 tb4cpm0 tb4cle tb4clk1 tb4clk0 r/w w* r/w 00100000 tb4ff1 inversion trigger 0: trigger disable 1: trigger enable software capture control 0: software capture 1: unde- fined capture timing 00: disable int9 occurs at rising edge 01: tb4in0 tb4in1 int9 occurs at rising edge 10: tb4in0 tb4in0 int9 occurs at falling edge 11: ta5out ta5out int9 occurs at rising edge up counter control 0: clear disable 1: clear enable tmrb4 input clock select 00: tb4in0 pin input 01: t1 10: t4 11: t16 invert when uc4 is loaded into tb4cp1h/l invert when uc4 matches with tb4rg1h/l tb4ffcr 16-bit timer frip-flop control 1c3h (rmw instruc- tions are pro- hibited.) tb4ff1c1 tb4ff1c0 tb4c1t1 tb4c0t1 tb4e1t1 tb4e0t1 tb4ff0c1 tb4ff0c0 w* r/w w* 11000011 tb4ff1 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. tb4ff0 inversion trigger 0: disable 1: enable tb4ff0 control 00: invert 01: set 10: clear 11: don?t care note: always read as 11. invert when uc4 is loaded into tb4cp1h/l. invert when uc4 is loaded into tb4cp0h/l. invert when uc4 matches tb4rg1h/l. invert when uc4 matches tb4rg0h/l. tb4rg0l 16-bit timer register 0l 1c8h (rmw instruc- tions are pro- hibited.) ? w undefined tb4rg0h 16-bit timer register 0h 1c9h (rmw instruc- tions are pro- hibited.) ? w undefined tb4rg1l 16-bit timer register 1l 1cah (rmw instruc- tions are pro- hibited.) ? w undefined tb4rg1h 16-bit timer register 1h 1cbh (rmw instruc- tions are pro- hibited.) ? w undefined tb4cp0l capture register 0l 1cch ? r undefined tb4cp0h capture register 0h 1cdh ? r undefined tb4cp1l capture register 1l 1ceh ? r undefined tb4cp1h capture register 1h 1cfh ? r undefined
page 300 2007-10-15 tmp91fw60 (8) uart / serial channel symbol name address 7 6 5 4 3 2 1 0 sc0buf serial channel 0 buffer 200h (rmw instruc- tions are pro- hibited.) rb7 / tb7 rb6 / tb6 rb5 / tb5 rb4 / tb4 rb3 / tb3 rb2 / tb2 rb1 / tb1 rb0 / tb0 r (receiving) / w (transmission) undefined sc0cr serial channel 0 control 201h (rmw instruc- tions are pro- hibited.) rb8 even pe oerr perr ferr sclks ioc r r/w r (cleared to "0" when read) r/w undefined 0 0 0 0 0 0 0 received data bit8 parity 0: odd 1: even parity addition 0: disable 1: enable overrun error flag 0: unde- tect error 1: detect error parity error flag 0: unde- tect error 1: detect error framing error flag 0: unde- tect error 1: detect error edge selection for sclk pin (i/o mode) 0: sclk 1: sclk i/o inter- face input clock selection 0: baud rate gener- ator 1: sclk pin input sc0mod0 serial channel 0 mode 0 202h tb8 ctse rxe wu sm1 sm0 sc1 sc0 r/w 00000000 transmis- sion data bit8 hand- shake function 0: disable 1: enable receive function 0: disable 1: enable wakeup function 0: disable 1: enable serial transmission mode 00: i/o interface mode 01: 7-bit uart mode 10: 8-bit uart mode 11: 9-bit uart mode serial transmission clock (uart) 00: timer ta0trg 01: baud rate generator 10: internal clock f sys 11: external clock (sclk input) br0cr baud ratel control 203h ? br0adde br0ck1 br0ck0 br0s3 br0s2 br0s1 br0s0 r/w 00000000 always write 0. + (16 - k)/ 16 division 0: disable 1: enable input clock selection for baud rate generator 00: t0 01: t2 10: t8 11: t32 setting of the divided frequency ?n? br0add serial channel 0 k setting register 204h ? ? ? ? br0k3 br0k2 br0k1 br0k0 ???? r/w ????0000 ???? sets frequency divisor ?k? (divided by n + (16 - k)/16) sc0mod1 serial channel 0 mode 1 205h i2s0 fdpx0 ? ? ? ? ? ? r/w ?????? 00?????? idle2 0: stop 1: run duplex 0: half 1: full ??????
page 301 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 sc1buf serial channel 1 buffer 208h (rmw instruc- tions are pro- hibited.) rb7 / tb7 rb6 / tb6 rb5 / tb5 rb4 / tb4 rb3 / tb3 rb2 / tb2 rb1 / tb1 rb0 / tb0 r (receiving) / w (transmission) undefined sc1cr serial channel 1 control 209h (rmw instruc- tions are pro- hibited.) rb8 even pe oerr perr ferr sclks ioc r r/w r (cleared to "0" when read) r/w undefined 0 0 0 0 0 0 0 received data bit8 parity 0: odd 1: even parity addition 0: disable 1: enable overrun error flag 0: unde- tect error 1: detect error parity error flag 0: unde- tect error 1: detect error framing error flag 0: unde- tect error 1: detect error edge selection for sclk pin (i/o mode) 0: sclk 1: sclk i/o inter- face input clock selection 0: baud rate gener- ator 1: sclk pin input sc1mod0 serial channel 1 mode 0 20ah tb8 ctse rxe wu sm1 sm0 sc1 sc0 r/w 00000000 transmis- sion data bit8 hand- shake function 0: disable 1: enable receive function 0: disable 1: enable wakeup function 0: disable 1: enable serial transmission mode 00: i/o interface mode 01: 7-bit uart mode 10: 8-bit uart mode 11: 9-bit uart mode serial transmission clock (uart) 00: timer ta0trg 01: baud rate generator 10: internal clock f sys 11: external clock (sclk input) br1cr baud ratel control 20bh ? br1adde br1ck1 br1ck0 br1s3 br1s2 br1s1 br1s0 r/w 00000000 always write ?0?. + (16 - k)/ 16 division 0: disable 1: enable input clock selection for baud rate generator 00: t0 01: t2 10: t8 11: t32 setting of the divided frequency ?n? br1add serial channel 1 k setting register 20ch ? ? ? ? br1k3 br1k2 br1k1 br1k0 ???? r/w ????0000 ???? sets frequency divisor ?k? (divided by n + (16 - k)/16) sc1mod1 serial channel 1 mode 1 20dh i2s1 fdpx1 ? ? ? ? ? ? r/w ?????? 00?????? idle2 0: stop 1: run duplex 0: half 1: full ??????
page 302 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 sc2buf serial channel 2 buffer 210h (rmw instruc- tions are pro- hibited.) rb7 / tb7 rb6 / tb6 rb5 / tb5 rb4 / tb4 rb3 / tb3 rb2 / tb2 rb1 / tb1 rb0 / tb0 r (receiving) / w (transmission) undefined sc2cr serial channel 2 control 211h (rmw instruc- tions are pro- hibited.) rb8 even pe oerr perr ferr sclks ioc r r/w r (cleared to "0" when read) r/w undefined 0 0 0 0 0 0 0 received data bit8 parity 0: odd 1: even parity addition 0: disable 1: enable overrun error flag 0: unde- tect error 1: detect error parity error flag 0: unde- tect error 1: detect error framing error flag 0: unde- tect error 1: detect error edge selection for sclk pin (i/o mode) 0: sclk 1: sclk i/o inter- face input clock selection 0: baud rate gener- ator 1: sclk pin input sc2mod0 serial channel 2 mode 0 212h tb8 ctse rxe wu sm1 sm0 sc1 sc0 r/w 00000000 transmis- sion data bit8 hand- shake function 0: disable 1: enable receive function 0: disable 1: enable wakeup function 0: disable 1: enable serial transmission mode 00: i/o interface mode 01: 7-bit uart mode 10: 8-bit uart mode 11: 9-bit uart mode serial transmission clock (uart) 00: timer ta0trg 01: baud rate generator 10: internal clock f sys 11: external clock (sclk input) br2cr baud ratel control 213h ? br2adde br2ck1 br2ck0 br2s3 br2s2 br2s1 br2s0 r/w 00000000 always write ?0?. + (16 - k)/ 16 division 0: disable 1: enable input clock selection for baud rate generator 00: t0 01: t2 10: t8 11: t32 setting of the divided frequency ?n? br2add serial channel 2 k setting register 214h ? ? ? ? br2k3 br2k2 br2k1 br2k0 ???? r/w ????0000 ???? sets frequency divisor ?k? (divided by n + (16 - k)/16) sc2mod1 serial channel 2 mode 1 215h i2s2 fdpx2 ? ? ? ? ? ? r/w ?????? 00?????? idle2 0: stop 1: run duplex 0: half 1: full ??????
page 303 2007-10-15 tmp91fw60 (9) i 2 c bus interface symbol name address 7 6 5 4 3 2 1 0 sbi0cr1 serial bus interface control register 1 240h (rmw instruc- tions are pro- hibited.) bc2 bc1 bc0 ack ? sck2 sck1 swrmon /sck0 wr/w?wr/w 0000?000/1 number of transferred bits 000: 8 001: 1 010: 2 011: 3 100: 4 101: 5 110: 6 111: 7 acknowl- edge clock 0: disable 1: enable ? at write internal serial clock selection and soft- ware reset monitor 000: 4 001: 5 010: 6 011: 7 100: 8 101: 9 110: 10 111:reserved at read 0: during software reset sbi0dbr sbi buffer register 241h (rmw instruc- tions are pro- hibited.) db7 db6 db5 db4 db3 db2 db1 db0 r (receiving) / w (transmission) undefined i2c0ar i 2 c bus address register 242h (rmw instruc- tions are pro- hibited.) sa6 sa5 sa4 sa3 sa2 sa1 sa0 als w 00000000 slave address selection for when device is operating as slave device address recognition 0: enable 1: disable when read sbi0sr serial bus interface status register 243h (rmw instruc- tions are pro- hibited.) mst trx bb pin al/ sbim1 aas/ sbim0 ad0/ swrst1 lrb/ swrst0 r/w 00010000 0: slave 1: master 0:receiver 1:transmit bus status monitor 0: free 1: busy[ intsbi request monitor 0: request 1: cancel arbitration lost detection monitor 1: detect slave address match detection monitor 1:detect general call detection 1: detect last receive bit monitor 0: ?0? 1: ?1? when write sbi0cr2 serial bus interface control register 2 start/stop condition 0: start condition 1: stop condition cancel intsbi interrupt request 0: ? 1: cancel serial bus interface operating mode selec- tion 00: port mode 01: reserved 10: i 2 c bus mode 11: reserved software reset generate write ?10? and ?01?, then an internal reset signal is generated. sbi0br serial bus interface baud rate register 244h (rmw instruc- tions are pro- hibited.) ?i2sbi0? ? ? ? ? ? wr/w?????r/w 00?????0 always write ?0? operation in idle2 mode 0: stop 1: operate ????? always write ?0? sbi0cr0 serial bus interface control register 0 247h (rmw instruc- tions are pro- hibited.) sbi0en??????? r/w r 00000000 sbi operation 0: disable 1: enable always read "0".
page 304 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 sbi1cr1 serial bus interface control register 1 248h (rmw instruc- tions are pro- hibited.) bc2 bc1 bc0 ack ? sck2 sck1 sck0/ swrmon wr/w?wr/w 0000?000/1 number of transferred bits 000: 8 001: 1 010: 2 011: 3 100: 4 101: 5 110: 6 111: 7 acknowl- edge clock 0: disable 1: enable ? at write internal serial clock selection and soft- ware reset monitor 000: 4 001: 5 010: 6 011: 7 100: 8 101: 9 110: 10 111:reserved at read 0: during software reset sbi1dbr sbi buffer register 249h (rmw instruc- tions are pro- hibited.) db7 db6 db5 db4 db3 db2 db1 db0 r (receiving) / w (transmission) ?s? i2c1ar i 2 c bus address register 24ah (rmw instruc- tions are pro- hibited.) sa6 sa5 sa4 sa3 sa2 sa1 sa0 als w 00000000 slave address selection for when device is operating as slave device address recognition 0: enable 1: disable when read sbi1sr serial bus interface status register 24bh (rmw instruc- tions are pro- hibited.) mst trx bb pin al/ sbim1 aas/ sbim0 ad0/ swrst1 lrb/ swrst0 r/w 00010000 0: slave 1: master 0:receiver 1:transmit bus status monitor 0: free 1: busy[ intsbi request monitor 0: request 1: cancel arbitration lost detection monitor 1: detect slave address match detection monitor 1:detect general call detection 1: detect last receive bit monitor 0: ?0? 1: ?1? when write sbi1cr2 serial bus interface control register 2 start/stop condition 0: start condition 1: stop condition cancel intsbi interrupt request 0: ? 1: cancel serial bus interface operating mode selec- tion 00: port mode 01: reserved 10: i 2 c bus mode 11: reserved software reset generate write ?10? and ?01?, then an internal reset signal is generated. sbi1br serial bus interface baud rate register 24ch (rmw instruc- tions are pro- hibited.) ?i2sbi1? ? ? ? ? ? wr/w?????r/w 00?????0 always write ?0? operation in idle2 mode 0: stop 1: operate ????? always write ?0? sbi1cr0 serial bus interface control register 0 24fh (rmw instruc- tions are pro- hibited.) sbi1en??????? r/w r 00000000 sbi operation 0: disable 1: enable always read "0".
page 305 2007-10-15 tmp91fw60 (10) ad converter symbol name address 7 6 5 4 3 2 1 0 adccr1 ad control register 1 2b0h adrs amd ainen sain r/w 00000000 ad con- version start 0: - 1: ad con- version start ad operating mode 00: ad operation disable 01: single mode 10: reserved 11: repeat mode analog input con- trol 0: disable 1: enable analog input channel select 0000: an0 0100: an4 1000: an8 1100: an12 0001: an1 0101: an5 1001: an9 1101: an13 0010: an2 0110: an6 1010: an10 1110: an14 0011: an3 0111: an7 1011: an11 1111: an15 adccr2 ad control register 2 2b1h eocf adbf rsel i2ad ack rr/w 00001100 ad con- version end flag 0:before or during conversion 1: conver- sion com- pleted ad con- version busy flag 0: during stop of ad conversion 1: during ad con- version storing of an ad conver- sion result 0: 10bit mode 1: 8bit mode idle2 control 0:stop 1:opera- tion ad conversion time select 1010: 78 / fc [s] 1011: 156 / fc [s] 1100: 312 / fc [s] 1101: 624 / fc [s] 1110: 1248 / fc [s] adcdrl ad result register l 2b2h ad07 ad06 ad05 ad04 ad03 ad02 ad01 ad00 r 00000000 adcdrh when 10-bit storing mode ad result register h 2b3h ??????ad09ad08 r 00000000 adcdrh when 8-bit storing mode ad09 ad08 ad07 ad06 ad05 ad04 ad03 ad02 r 00000000
page 306 2007-10-15 tmp91fw60 (11) watchdog timer symbol name address 7 6 5 4 3 2 1 0 wdmod wdt mode register 300h wdte wdtp1 wdtp0 ? ? i2wdt rescr ? r/w ? ? r/w 000??000 wdt control 1: enable select detecting time 00: 2 15 /f sys 01: 2 17 /f sys 10: 2 19 /f sys 11: 2 21 /f sys ?? idle2 0: stop 1: operate 1: inter- mally con- nects wdt out to the reset pin always write ?0?. wdcr wdt control 301h (rmw instruc- tions are pro- hibited.) ? w ? b1h: wdt disable code 4eh: wdt clear code (12) special timer for clock symbol name address 7 6 5 4 3 2 1 0 rtccr rtc control register 310h ? ? ? ? ? rtcsel1 rtcsel0 rtcrun r/w???? r/w 0????000 always write ?0?. ???? 00: 2 14 /fs 01: 2 13 /fs 10: 2 12 /fs 11: 2 11 /fs 0: stop & clear 1: count
page 307 2007-10-15 tmp91fw60 (13) program patch logic symbol name address 7 6 5 4 3 2 1 0 romcmp00 address compare register 00 400h (rmw instruc- tions are pro- hibited.) romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? w? 0000000? target rom address (lower 7 bits) ? romcmp01 address compare register 01 401h (rmw instruc- tions are pro- hibited.) romc15 romc14 romc13 romc12 romc11 romc10 romc09 romc08 w 00000000 target rom address (middle 8 bits) romcmp02 address compare register 02 402h (rmw instruc- tions are pro- hibited.) romc23 romc22 romc21 romc20 romc19 romc18 romc17 romc16 w 00000000 target rom address (upper 8 bits) romsub0l address substitution register 0l 404h (rmw instruc- tions are pro- hibited.) roms07 roms06 roms05 roms04 roms03 roms02 roms01 roms00 w 00000000 patch code (lower 8 bits) romsub0h address substitution register 0h 405h (rmw instruc- tions are pro- hibited.) roms15 roms14 roms13 roms12 roms11 roms10 roms09 roms08 w 00000000 patch code (upper 8 bits) romcmp10 address compare register 10 408h (rmw instruc- tions are pro- hibited.) romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? w? 0000000? target rom address (lower 7 bits) ? romcmp11 address compare register 11 409h (rmw instruc- tions are pro- hibited.) romc15 romc14 romc13 romc12 romc11 romc10 romc09 romc08 w 00000000 target rom address (middle 8 bits) romcmp12 address compare register 12 40ah (rmw instruc- tions are pro- hibited.) romc23 romc22 romc21 romc20 romc19 romc18 romc17 romc16 w 00000000 target rom address (upper 8 bits) romsub1l address substitution register 1l 40ch (rmw instruc- tions are pro- hibited.) roms07 roms06 roms05 roms04 roms03 roms02 roms01 roms00 w 00000000 patch code (lower 8 bits) romsub1h address substitution register 1h 40dh (rmw instruc- tions are pro- hibited.) roms15 roms14 roms13 roms12 roms11 roms10 roms09 roms08 w 00000000 patch code (upper 8 bits)
page 308 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 romcmp20 address compare register 20 410h (rmw instruc- tions are pro- hibited.) romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? w? 0000000? target rom address (lower 7 bits) ? romcmp21 address compare register 21 411h (rmw instruc- tions are pro- hibited.) romc15 romc14 romc13 romc12 romc11 romc10 romc09 romc08 w 00000000 target rom address (middle 8 bits) romcmp22 address compare register 22 412h (rmw instruc- tions are pro- hibited.) romc23 romc22 romc21 romc20 romc19 romc18 romc17 romc16 w 00000000 target rom address (upper 8 bits) romsub2l address substitution register 2l 414h (rmw instruc- tions are pro- hibited.) roms07 roms06 roms05 roms04 roms03 roms02 roms01 roms00 w 00000000 patch code (lower 8 bits) romsub2h address substitution register 2h 415h (rmw instruc- tions are pro- hibited.) roms15 roms14 roms13 roms12 roms11 roms10 roms09 roms08 w 00000000 patch code (upper 8 bits) romcmp30 address compare register 30 418h (rmw instruc- tions are pro- hibited.) romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? w? 0000000? target rom address (lower 7 bits) ? romcmp31 address compare register 31 419h (rmw instruc- tions are pro- hibited.) romc15 romc14 romc13 romc12 romc11 romc10 romc09 romc08 w 00000000 target rom address (middle 8 bits) romcmp32 address compare register 32 41ah (rmw instruc- tions are pro- hibited.) romc23 romc22 romc21 romc20 romc19 romc18 romc17 romc16 w 00000000 target rom address (upper 8 bits) romsub3l address substitution register 3l 41ch (rmw instruc- tions are pro- hibited.) roms07 roms06 roms05 roms04 roms03 roms02 roms01 roms00 w 00000000 patch code (lower 8 bits) romsub3h address substitution register 3h 41dh (rmw instruc- tions are pro- hibited.) roms15 roms14 roms13 roms12 roms11 roms10 roms09 roms08 w 00000000 patch code (upper 8 bits)
page 309 2007-10-15 tmp91fw60 symbol name address 7 6 5 4 3 2 1 0 romcmp40 address compare register 40 420h (rmw instruc- tions are pro- hibited.) romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? w? 0000000? target rom address (lower 7 bits) ? romcmp41 address compare register 41 421h (rmw instruc- tions are pro- hibited.) romc15 romc14 romc13 romc12 romc11 romc10 romc09 romc08 w 00000000 target rom address (middle 8 bits) romcmp42 address compare register 22 422h (rmw instruc- tions are pro- hibited.) romc23 romc22 romc21 romc20 romc19 romc18 romc17 romc16 w 00000000 target rom address (upper 8 bits) romsub4l address substitution register 4l 424h (rmw instruc- tions are pro- hibited.) roms07 roms06 roms05 roms04 roms03 roms02 roms01 roms00 w 00000000 patch code (lower 8 bits) romsub4h address substitution register 4h 425h (rmw instruc- tions are pro- hibited.) roms15 roms14 roms13 roms12 roms11 roms10 roms09 roms08 w 00000000 patch code (upper 8 bits) romcmp50 address compare register 50 428h (rmw instruc- tions are pro- hibited.) romc07 romc06 romc05 romc04 romc03 romc02 romc01 ? w? 0000000? target rom address (lower 7 bits) ? romcmp51 address compare register 51 429h (rmw instruc- tions are pro- hibited.) romc15 romc14 romc13 romc12 romc11 romc10 romc09 romc08 w 00000000 target rom address (middle 8 bits) romcmp52 address compare register 52 42ah (rmw instruc- tions are pro- hibited.) romc23 romc22 romc21 romc20 romc19 romc18 romc17 romc16 w 00000000 target rom address (upper 8 bits) romsub5l address substitution register 5l 42ch (rmw instruc- tions are pro- hibited.) roms07 roms06 roms05 roms04 roms03 roms02 roms01 roms00 w 00000000 patch code (lower 8 bits) romsub5h address substitution register 5h 42dh (rmw instruc- tions are pro- hibited.) roms15 roms14 roms13 roms12 roms11 roms10 roms09 roms08 w 00000000 patch code (upper 8 bits)
page 310 2007-10-15 tmp91fw60 17. i/o port equivalent-circuit diagrams ? how to read circuit diagrams the circuit diagrams in this chapte r are drawn using the same gate symb ols as for the 74hc xx series stan- dard cmos logic ics. the signal named stop has a unique function. this si gnal goes active-high if the cpu sets the halt bit when the haltm[1:0] field in the syscr2 register is programmed to 01 (e.g., stop mode) and the drive enable (drve) bit in the same register is cleared. if the drve bit is set, the stop signal remains inactive (at logic 0). ? the input protection circuit has a resistor in the range of several tens to several hundreds of ohms. 17.1 equivalent circuit diagrams 1. p0 (ad0 to ad7), p1 (ad8 to ad15, a8 to a15), p2 (a16 to a23, a0 to a7) 2. pz0 (rd ), pz1 (wr ) 3. p5 (an0 to an7), p6 (an8 to an15) v cc 1wvrwvfcvc p-ch +prwv1wvrwv +prwvfcvc 1wvrwvgpcdng stop +prwvgpcdng n-ch 1wvrwv v cc 1wvrwvfcvc stop p-ch n-ch #pcnqikprwv ejcppgnugngev #pcnqikprwv v cc 1wvrwvfcvc p-ch +prwv1wvrwv +prwvfcvc 1wvrwvgpcdng stop +prwvgpcdng n-ch
page 311 2007-10-15 tmp91fw60 4. pz2 (hwr ), pz3 (r/w ), p44(ale) 5. p40(cs0 /scout), p41(cs1 /txd2), p42(cs2 /rxd2), p43(cs3 /sclk2/cts2 ) 6. p75 (int0) 7. p32(wait /tb3out0), p33(tb3out1), p70(ta0in), p71(ta1out), p72(ta3out), p73(ta4in), p74(ta5out), p80 to p87,p91(rxd0), p92(sclk0/cts0 ), p94(rxd1), p95(sclk1/cts1 ), pa0 to pa3,pb2(tb4out0), pb3(tb4out1) +prwv1wvrwv +prwvgpcdng vcc 1wvrwvfcvc 1wvrwvgpcdng stop +prwvfcvc vcc 2tqitcoocdng rwnnwrtgukuvqt p-ch n-ch +prwv1wvrwv +p r wvgpcdng v cc 1wvrwvfcvc 1wvrwvgpcdng stop +prwvfcvc vcc 2tqitcoocdng rwnnwrtgukuvqt p-ch n-ch +prwv1wvrwv uejokvvvtkiigt v cc 1wvrwvfcvc 1wvrwvgpcdng stop +prwvfcvc  p-ch n-ch v cc 1wvrwvfcvc p-ch +prwv1wvrwv +prwvfcvc 1wvrwvgpcdng stop +p r wvgpcdng n - ch
page 312 2007-10-15 tmp91fw60 8. p30(tb3in0/int3/sda0), p31( tb3in1/int4/scl0), p90(txd0), p93(txd1), pb0(tb4in0/int9/ sda1), pb1(tb4in1/int10/scl1) 9. p96 (xt1), p97 (xt2) 10. nmi 11. am0 to am1 12. reset +prwv1wvrwv +p r wvgpcdng v cc 1wvrwvfcvc stop +prwvfcvc 1rgpftckp qwvrwvgpcdng  p-ch n-ch p96(xt1) p97(xt2) stop ^ vcc vcc +prwvfcvc 1wvrwvfcvc 1wvrwvgpcdng +prwvfcvc 1wvrwvfcvc 1wvrwvgpcdng .qyhtgswgpe[queknncvqtgpcdng +prwvgpcdng +prwvgpcdng %nqem 1ueknncvqtektewkv p-ch n-ch p-ch n-ch +prwv nmi 5ejokvvvtkiigt +prwv +prwv wdtout 4gugv 4gugvgpcdng 5ejokvvvtkiigt p-ch vcc
page 313 2007-10-15 tmp91fw60 13. x1, x2 14. vrefh, avss x2 *kijhtgswgpe[ queknncvqtgpcdng 1ueknncvqtektewkv p - ch n - ch %n qe m  x1 v refh vrefon a vss p-ch .cffgttgukuvqtu
page 314 2007-10-15 tmp91fw60 18. points to note and restrictions 18.1 notation a. the notation for built-in i/o registers is as follows register symbol e.g.) ta01run denotes bit ta0run of register ta01run. b. read-modify-write instructions an instruction in which the cpu reads data from memo ry and writes the data to the same memory loca- tion in one instruction. example 1: set 3, (ta01run) ... set bit3 of ta01run. example 2: inc 1, (100h) ... increment the data at 100h. ? examples of read-modify-write instructions on the tlcs-900 exchange instruction ex (mem), r arithmetic operations add (mem), r/# adc (mem), r/# sub (mem), r/# sbc (mem), r/# inc #3, (mem) dec #3, (mem) logic operations and (mem), r/# or (mem), r/# xor (mem), r/# bit manipulation operations stcf #3/a, (mem) res #3, (mem) set #3, (mem) chg #3, (mem) tset #3, (mem) rotate and shift operations rlc (mem) rrc (mem) rl (mem) rr (mem) sla (mem) sra (mem) sll (mem) srl (mem) rld (mem) rrd (mem) c. f osch , fc , fs , f fph , f sys and one state the clock frequency input on pins x1 and 2 is called f osch or fc. the clock selected by syscr1 is called f fph . the clock frequency give by f fph divided by 2 is called f sys . one cycle of f sys is referred to as one state.
page 315 2007-10-15 tmp91fw60 18.2 points of note a. am0 and am1 pins this pin is connected to th e dvcc pin. do not alter the level when the pin is active. b. emu0 and emu1 pins open pins. c. halt mode (idle1) when idle1 mode (in which oscillator operati on only occurs) is used, set rtccr to 0 stop the special timer for clock befo re the halt instructions is executed. d. warm-up counter the warm-up counter operates when stop mode is re leased, even if the syst em is using an external oscillator. as a result a time equivalent to the warm -up time elapses between input of the release request and output of the system clock. e. programmable pull-up/pull-down resistances the programmable pull-up/pull-down resistor can be turned on/off by a prog ram when the ports are set for use as input ports. when the ports are set for use as output ports , they cannot be turned on/off by a program. the data registers (e.g., p4) are used to turn the pull-up/pull-down resistors on/off. consequently read-modify-write instru ctions are prohibited. f. watchdog timer the watchdog timer starts operation immediately after a reset is released. when the watchdog timer is not to be used, disable it. when the bus is released, neither internal memory nor internal i/o can be acce ssed. however, the inter- nal i/o continues to operate. hen ce the watchdog timer continues to ru n. therefore be careful about the bus releasing time and set the detection timer of watchdog timer. g. cpu (micro dma) only the ldc cr, r and ldc r, cr instructions can be used to access the control registers in the cpu (e.g., the transfer source address register (dmasn)). h. undefined sfr the value of an undefined bit in an sfr is undefined when read. i. pop sr instruction please execute the pop sr instruction during di condition. j. clocks for serial channels (sio) as for the serial channels sio0, si o1 and sio2, a baud rate generator is unavailable as an input clock of an i/o interface and a clock for a serial tran sfer if a prescaler clock is set to fc/16 when syscr0 is "1".
page 316 2007-10-15 tmp91fw60 19. package dimension lqfp100-p-1414-0.50f unit: mm
page 317 2007-10-15 tmp91fw60 qfp100-p-1420-0.65a unit: mm
postscript this is a technical document that describes the oper ating functions and electrical specifications of the 16- bit microcontroller series tlcs-900/l1 (lsi). toshiba provides a variety of development tools an d basic software to enable efficient software development. these development tools have specifications that suppo rt advances in microcomputer hardware (lsi) and can be used extensively. both the hardware and soft ware are supported continuou sly with version updates. the recent advances in cmos ls i production technology have been phenomenal and microcomputer systems for lsi design are constantly being improved. the products described in this document may also be revised in the future. be sure to check the latest specifications before using. toshiba is developing highly integrated, high-performance microcomputers using advanced mos production technology and especially well proven cmos technology. we are prepared to meet the requests for custom packaging for a variety of application areas. we are confident that our products can satisfy your application needs now and in the future.


▲Up To Search▲   

 
Price & Availability of TMP91FW60FG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X